GUK estimation

Seiro Ito

2024年08月18日 11:48

Overview

This note uses ANCOVA as the estimator of choice. ANCOVA assumes the initial value of outcome variable is a pure nusissance that it only adds a noise and is uncorrelated with the main regressor of interest, hence uses it as a covariate. Under such assumptions, it is shown that ANCOVA is more efficient than DID as it renders data to control for baseline differences in outcomes (Frison and Pocock 1992Frison, Lars, and Stuart J. Pocock. 1992. “Repeated Measures in Clinical Trials: Analysis Using Mean Summary Statistics and Its Implications for Design.” Statistics in Medicine 11 (13): 1685–1704. https://doi.org/10.1002/sim.4780111304.). ANCOVA become numerically the same as DID if the estimated coefficient on the covariate is unity. As shown in the results, we see that it smaller and the claim that DID overcorrects for the initial values applies to our data.

Click here to see the code of paths and definitions.
library(data.table)
library(qs)
pathprogram <- paste0(path, "program/");  
pathsource <- paste0(path0, "source/")
pathsave <- paste0(path, "save/")
pathsaveHere <- paste0(pathsave, "EstimationMemo/")
pathfigure <- pathsavefigure <- paste0(pathprogram, "figure/")
pathtable <- paste0(pathprogram, "table/")
pathreceived <- paste0(path0, "received/")
pathcleaned <- paste0(pathreceived, "cleaned_by_RA/")
path1234 <- paste0(pathcleaned, "clean_panel_data_by_section/")
dir.create(pathsave)
dir.create(pathsaveHere)
file.remove(list.files("program/cache", full.names = T))
#### Uncommenting below deletes all input/output of R from html. Why???
#### render_listings()  ####    it changes "<-" to real arrows, etc., prettifying
#### Tabulation functions
source(paste0(pathprogram, "TabulationFunctions.R"))
#### substitution table "sbt"
source(paste0(pathprogram, "SubstTable.R"))
source(paste0(pathprogram, "SubstTableANCOVA.R"))
source(paste0(pathprogram, "SubstTablePerm.R"))
#### Estimation functions
source(paste0(pathprogram, "EstimationFunctions.R"))
#### CombinenamesXYZ functions
source(paste0(pathprogram, "GetCovariatesFunctions.R"))
RMDenomination <- 1000
datafiles <- c("s1", "arA", "ar", "ass", "lvo", "lvoL", "lvp", "lab", "far", "con", "obr")
Datafiles <- c("S1", "ArA", "Ar", "Ass", "Lvo", "LvoL", "Lvp", "Lab", "Far", "Con", "Obr")
DataFileNames <- c(
  "Schooling", "AllMeetingsRepayment", "Repayment", "Asset", 
  "Livestock", "LivestockLong", "LivestockProducts",
  "LabourIncome", "FarmIncome", "Consumption", "OtherBorrowing")
ShortfallFileNames<- c("Group", "Individual", "o800")
FileNameHeader <- paste0(c("", "Grace", "PovertyStatus", "Size", "Attributes"),
  "OriginalHHs")
filenamelist <- c("Group", "Individual")
arms <- c("traditional", "large", "large grace", "cow")
Arms <- c("Traditional", "Large", "LargeGrace", "Cow")
armsC <- c("traditional", "large", "large grace", "cattle")
ArmsC <- c("Traditional", "Large", "Large grace", "Cattle")
ArmsC2 <- c("Traditional", "Large", "LargeGrace", "Cattle")
Attributes <- c("Traditional", "LargeSize", "WithGrace", "InKind")
InitialSampleMonthUpperBound <- 6
Only800 <- T
UseTrimmedSample <- T
NotPrintFileNames <- ""
#NotPrintFileNames <- "%"
PrintFormulae <- F
PermRepTimes <- 100000

Read and format data

Cleaning process (not done in this file)

This file uses the cleaned data. Cleaning is done in the following steps.

  1. read_cleaned_data.rnw cleans original data files (incl. Abu-san’s correction files) and creates NewVariables \(\rightarrow\) data_read_in_a_list_with_baseline_patched.rds
  2. ReadFilesMergeAdminRoster.rnw adds admin data \(\rightarrow\)

    Individual data files (RosterAdminSchoolingData.rds, RosterAdminData.rds, AllMeetingsRosterAdminData.rds, AssetAdminData.rds, LivestockAdminData.rds, LivestockLongAdminData.rds, LivestockProductsAdminData.rds, LabourIncomeAdminData.rds, FarmRevenueAdminData.rds, ConsumptionAdminData.rds, OtherBorrowingAdminData.rds, Shocks.rds) in c:/data/GUK/analysis/save/EstimationMemo/.

  3. Trimming, adding shocks, survey round numbering, create dummy vectors, interaction terms \(\rightarrow\)

    SchoolingAdminDataUsedForEstimation.prn, AllMeetingsRepaymentAdminDataUsedForEstimation.prn, RepaymentAdminDataUsedForEstimation.prn, AssetAdminDataUsedForEstimation.prn, LivestockAdminDataUsedForEstimation.prn, LivestockLongAdminDataUsedForEstimation.prn, LivestockProductsAdminDataUsedForEstimation.prn, LabourIncomeAdminDataUsedForEstimation.prn, FarmIncomeAdminDataUsedForEstimation.prn, ConsumptionAdminDataUsedForEstimation.prn, OtherBorrowingAdminDataUsedForEstimation.prn

Click here to see the code of data dimension check.
#### Name as sch1, sch2 rather than s1, s2 (as in other files) 
#### to display "s1" in TrimmingNumObsTable
#### - Using data [data_read_in_a_list_with_baseline_patched.rds],
####   the following data files are created in ReadFilesMergeAdminRoster.rnw 
####   (with the child file ImpactEstimationOriginal1600Memo2_body1.rnw). 
#### - Each file includes xid (admin) info.
s1 <- readRDS(paste0(pathsaveHere, "RosterAdminSchoolingData.rds"))
ar <- readRDS(paste0(pathsaveHere, "RosterAdminData.rds"))
arA <- readRDS(paste0(pathsaveHere, "AllMeetingsRosterAdminData.rds"))
ass <- readRDS(paste0(pathsaveHere, "AssetAdminData.rds"))
lvo <- readRDS(paste0(pathsaveHere, "LivestockAdminData.rds")) # dummyHadCows?
lvoL <- readRDS(paste0(pathsaveHere, "LivestockLongAdminData.rds"))
lvp <- readRDS(paste0(pathsaveHere, "LivestockProductsAdminData.rds"))
lab <- readRDS(paste0(pathsaveHere, "LabourIncomeAdminData.rds"))
far <- readRDS(paste0(pathsaveHere, "FarmRevenueAdminData.rds"))
con <- readRDS(paste0(pathsaveHere, "ConsumptionAdminData.rds"))
obr <- readRDS(paste0(pathsaveHere, "OtherBorrowingAdminData.rds"))
shk <- readRDS(paste0(pathsaveHere, "Shocks.rds"))
interterms <- c("Time.2", "Time.3", "Time.4")
Arms <- c("Traditional", "Large", "LargeGrace", "Cow")
arms <- c("traditional", "large", "large grace", "cow")
povertystatus <- c("UltraPoor", "ModeratelyPoor")
s1[, tee := survey]
dimchange <- dimchangeRd1 <- dimchangeRd1o800 <- NULL
datafiles
 [1] "s1"   "arA"  "ar"   "ass"  "lvo"  "lvoL" "lvp"  "lab"  "far"  "con"  "obr" 
for (j in 1:length(datafiles)) {
####  if (j == 1) print0(paste("old|iRej|^g in Mstatus", "==>", "con|^dro|^rep in Mgroup", "==>", "No tw|dou in TradGroup"))
  dd <- get(datafiles[j])
  if (!any(grepl("^tee$", colnames(dd)))) dd[, tee := 1:.N, by = hhid]
  # show trimming results
  # all sample
  dimchange <- rbind(dimchange, paste(datafiles[j], ":", nrow(dd), 
    "==>", 
    nrow(dd[grepl("old|iRej|^g", Mstatus), ]),
####    "==>", 
####    nrow(dd[grepl("old|iRej|^g", Mstatus), ][grepl("con|dro", Mgroup), ]), 
    "==>", 
    nrow(dd[grepl("old|iRej|^g", Mstatus), ][!grepl("tw|dou", TradGroup), ])
    ))
  if (!grepl("con", datafiles[j])) {
    # all sample, rd 1 only
    dimchangeRd1 <- rbind(dimchangeRd1, paste(datafiles[j], ":", 
      nrow(dd[tee == 1 & survey == 1, ]), 
      "==>", 
      nrow(dd[tee == 1 & survey == 1 & grepl("old|iRej|^g", Mstatus), ]),
      "==>", 
      nrow(dd[tee == 1 & survey == 1 & grepl("old|iRej|^g", Mstatus), ][!grepl("tw|dou", TradGroup), ])
      ))
    if (grepl("arA", datafiles[j])) TradTwice <- 
        nrow(dd[tee == 1 & survey == 1 & o800 == 1L & grepl("old|iRej|^g", Mstatus) & grepl("rad", Arm), ]) -
        nrow(dd[tee == 1 & survey == 1 & o800 == 1L & grepl("old|iRej|^g", Mstatus) & grepl("rad", Arm), ][!grepl("tw|dou", TradGroup), ])
    # all sample, rd 1 only
    dimchangeRd1o800 <- rbind(dimchangeRd1o800, 
      paste(datafiles[j], ":", 
      nrow(dd[tee == 1 & survey == 1 & o800 == 1L, ]), 
      "==>", 
      nrow(dd[tee == 1 & survey == 1 & o800 == 1L & grepl("old|iRej|^g", Mstatus), ]),
      "==>", 
      nrow(dd[tee == 1 & survey == 1 & o800 == 1L & grepl("old|iRej|^g", Mstatus), ][
      !grepl("tw|dou", TradGroup), ])
      ))
  } else {
  # consumption
    # all sample, rd 2 only
    dimchangeRd1 <- rbind(dimchangeRd1, paste(datafiles[j], ":", 
      nrow(dd[tee == 1 & survey == 2, ]), 
      "==>", 
      nrow(dd[tee == 1 & survey == 2 & grepl("old|iRej|^g", Mstatus), ]),
      "==>", 
      nrow(dd[tee == 1 & survey == 2 & grepl("old|iRej|^g", Mstatus), ][!grepl("tw|dou", TradGroup), ])
      ))
    # all sample, rd 2 only
    dimchangeRd1o800 <- rbind(dimchangeRd1o800, 
      paste(datafiles[j], ":", 
      nrow(dd[tee == 1 & survey == 2 & o800 == 1L, ]), 
      "==>", 
      nrow(dd[tee == 1 & survey == 2 & o800 == 1L & grepl("old|iRej|^g", Mstatus), ]),
      "==>", 
      nrow(dd[tee == 1 & survey == 2 & o800 == 1L & grepl("old|iRej|^g", Mstatus), ][
      !grepl("tw|dou", TradGroup), ])
      ))
   }
}
dmch <- gsub("==>", " & $\\\\Rightarrow$ &", dimchange)
dmch <- gsub(":", " & ", dmch)
#dmch <- rbind("file & & old$|$iRej$|$\\^{}g in \`Mstatus` && con$|$dro in \`Mgroup` && No tw$|$dou in \`TradGroup` &", dmch)
dmch <- rbind("file & & old$|$iRej$|$\\^{}g in \`Mstatus` && No tw$|$dou in \`TradGroup` &", 
  "\\makebox[1.5cm]{\\footnotesize all rounds}&&&&&",
  dmch)
dmch <- gsub("$", " \\\\\\\\ ", dmch)
dmchRd1 <- gsub("==>", " & $\\\\Rightarrow$ &", dimchangeRd1)
dmchRd1 <- gsub(":", " & ", dmchRd1)
dmchRd1 <- rbind("\\makebox[1.5cm]{\\footnotesize round 1 only}&&&&&",
  dmchRd1)
dmchRd1 <- gsub("$", " \\\\\\\\ ", dmchRd1)
dmchRd1o800 <- gsub("==>", " & $\\\\Rightarrow$ &", dimchangeRd1o800)
dmchRd1o800 <- gsub(":", " & ", dmchRd1o800)
dmchRd1o800 <- rbind("\\multicolumn{6}{l}{\\footnotesize original 800, round 1 only}",
  dmchRd1o800)
dmchRd1o800 <- gsub("$", " \\\\\\\\ ", dmchRd1o800)
hleft = c("\\sf", c(rbind(rep("\\hfill", 2), rep("\\hfil", 2)), "\\hfill"))
hcenter = c(1.5, c(rbind(rep(1, 2), rep(1.5, 2)), 1))
write.tablev(
  rbind(paste("\\begin{tabular}{", 
    paste(paste0(">{\\footnotesize ", hleft, "}", "p{", hcenter, "cm}", "<{}"), collapse = ""), "}\\rowcolor{paleblue}"),
  dmch, 
  dmchRd1, 
  dmchRd1o800, 
  "\\end{tabular}"), 
  paste0(pathsaveHere, "TrimmingNumObsTable.tex"), colnamestrue = F)
#print0(rbind(paste("(old|iRej|^g in Mstatus)", "==>", "(con|^dro|^rep in Mgroup)", "==>", "(No tw|dou in TradGroup)"), dimchange))

Creating ’EachFileName’Trimmed.rds files to be used in permutation tests

RosterAdmin.rds keeps all 800 members which will be used in attrition and randomisation tests. Add BStatus etc. from the admin roster file (RosterAdminData.rds) to all files and save as:

PathToSaveFolder/'EachFileName'Trimmed.rds

Produced files are called “Trimmed” files as we keep only grepl("old|iRej|^g", Mstatus) (old members, individual rejection, group rejection, group erosion). Here, we have not yet dropped grepl("tw|dou", TradGroup) (twice received, double received in traditional arm). We use “Trimmed” files for attrition and randomisation tests to assess differnces at baseline.

To produce Trimmed files, first create RepaymentTrimmed.rds sample from RosterAdminData.rds and attach its variables to each files.

In RosterAdminData.rds, there are 800 HHs at the baseline, whose size shrinks by attrition: 743, 745, 708.

Click here to see the code to produce “Trimmed” files.
#### All files are created by merging admin files in ReadFilesMergeAdminRoster.rnw
s1 <- readRDS(paste0(pathsaveHere, "RosterAdminSchoolingData.rds"))
ar <- readRDS(paste0(pathsaveHere, "RosterAdminData.rds"))
arA <- readRDS(paste0(pathsaveHere, "AllMeetingsRosterAdminData.rds"))
ass <- readRDS(paste0(pathsaveHere, "AssetAdminData.rds"))
lvo <- readRDS(paste0(pathsaveHere, "LivestockAdminData.rds")) # dummyHadCows?
lvoL <- readRDS(paste0(pathsaveHere, "LivestockLongAdminData.rds"))
lvp <- readRDS(paste0(pathsaveHere, "LivestockProductsAdminData.rds"))
lab <- readRDS(paste0(pathsaveHere, "LabourIncomeAdminData.rds"))
far <- readRDS(paste0(pathsaveHere, "FarmRevenueAdminData.rds"))
con <- readRDS(paste0(pathsaveHere, "ConsumptionAdminData.rds"))
obr <- readRDS(paste0(pathsaveHere, "OtherBorrowingAdminData.rds"))
shk <- readRDS(paste0(pathsaveHere, "Shocks.rds"))
#### Add shock variables to each file
shk <- shk[survey == 1, ]
shk[, grepout("gid|Dat|Ye|Mo|surv|code", colnames(shk)) := NULL]
shk[is.na(groupid), groupid := as.integer(substr(hhid, 1, 8))]
setkey(shk, groupid, hhid)
#### shk[, Month := factor(Month, levels = 
####   c("January", "February", "March", "April", 
####   #"May", "June", "July",
####   "August", "September", "November", "October",   "December"))]
setnames(s1, "tee", "meet.tee") # meeting periods
setnames(s1, "i.tee", "tee") # tee = survey rounds
Obs <- NULL
for (j in 1:length(datafiles)) {
  dd <- get(datafiles[j])
  setkey(dd, hhid, Year, Month)
  if (!any(grepl("^tee$", colnames(dd)))) dd[, tee := 1:.N, by = hhid]
  dd[, Arm := droplevels(Arm)]
  if (any(grepl("IntDate", colnames(dd))))
    dd[, Year :=  as.integer(strftime(IntDate, format = "%Y"))] else
  if (any(grepl("^Date$", colnames(dd))))
    dd[, Year :=  as.integer(strftime(Date, format = "%Y"))]
  # 1. Keep only membership = 1 or 4, which corresponds to 
  # Mstatus old, iRej, gR, gE (on going members, indiv rejecters, group rejecters, group erosion)
  addmargins(table(dd[o800 == 1L & tee == 1, .(Arm)]))
  dd <- dd[grepl("old|iRej|^g", Mstatus), ]
  # 2. Keep only continuing, dropouts members in Mgroup.
  #dd <- dd[grepl("con|dro", Mgroup), ]
  # Rejecters do not receive loans. So I need to relax creditstatus = yes condition.
  # Remark out the following:
  # dd <- dd[grepl("Yes", creditstatus), ]
  #  dd <- dd[as.Date(DisDate1) < as.Date("2015-01-01"), ]
  # drop TradGroup = twice, double. This drops 24 members in traditional. When I do this, they will not be included in any data that are merged with ar.
  tb <- as.data.frame.matrix(table(ar[o800 == 1 & tee == 1 & grepl("tw|dou", TradGroup), 
    .(gid, DisDate1)]))
  # DisDates of 24 traditional arm members disbursement is less than 3 times.
  # tb[apply(tb, 1, sum)>0, ]
  # one can drop 24 members of trad, but leave it to later to decide
  #dd <- dd[!grepl("tw|dou", TradGroup), ]
#grepl("es", creditstatus) & as.Date(DisDate1) <= as.Date("2015-01-01") & !grepl("tw|dou", TradGroup)
  setkey(dd, groupid, hhid)
  dd[, MonthGap := min(DisDate1, na.rm = T), by = groupid]
  dd[MonthGap == Inf, MonthGap := NA]
  dd[, MonthGap := round(
    as.numeric(DisDate1 - MonthGap)/(60*60*24*30.4375), 2)]
#### BStatus is defined in ReadFilesMergeAdmin
####   dd[, BStatus := BorrowerStatus]
####   dd[grepl("gRe", Mstatus), BStatus := "group rejection"]
####   dd[grepl("iRej", Mstatus), BStatus := "individual rejection"]
####   dd[grepl("gEr", Mstatus), BStatus := "rejection by flood"]
####   dd[, BStatus := factor(BStatus, levels = c("borrower", "pure saver", 
####     "individual rejection", "group rejection", "rejection by flood"))]
  # merge shock module
  setkey(dd, groupid, hhid)
  # Below way of merge drops 4 HHs in roster admin data: 800 => 796. Should be avoided.
  # setkey(dd, hhid, Year, Month)
  # shk[, o800 := NULL]
  # Use this merge instead.
  dd2 <- merge(dd, shk, by = c("groupid", "hhid", "o800"), all.x = T)
  addmargins(table0(dd2[o800 == 1L, .(tee, Arm)]))
  dd2[, c("en") := NULL]
  dd2[, teeyr := 1]
  dd2[Year == 2014, teeyr := 2]
  dd2[Year == 2015, teeyr := 3]
  dd2[Year == 2016, teeyr := 3]
  dd2[Year == 2017, teeyr := 4]
  dd2[, Time := teeyr]
  setkey(dd2, hhid, Year, teeyr)
  dd2 <- data.table(dd2, 
    makeDummyFromFactor(dd2[, Arm], reference = NULL))
  if (any(grepl("dummyLarge grace", colnames(dd2)))) 
    setnames(dd2, grepout("dummyLarge grace", colnames(dd2)), 
      gsub("dummyLarge g", "dummyLargeG", 
        grepout("dummyLarge grace", colnames(dd2))))
  if (any(grepl("dummyNANA", colnames(dd2)))) 
    dd2[, dummyNANA := NULL]
  #dd2[, dummyDropOuts := NULL]
  dd2[, povertystatus := factor(povertystatus, 
    labels = c("Ultra Poor", "Moderately Poor"))]
  dd2 <- data.table(dd2, 
    makeDummyFromFactor(dd2[, povertystatus], reference = NULL))
  setnames(dd2, c("dummyUltra Poor", "dummyModerately Poor"),
    c("dummyUltraPoor", "dummyModeratelyPoor"))
  dd2[, c("Size", "Grace", "Item") := .("SmallSize", "WithoutGrace", "Cash")]
  dd2[!grepl("tra", Arm), Size := "LargeSize"]
  dd2[grepl("gr|cow|catt", Arm), Grace := "WithGrace"]
  dd2[grepl("cow|catt", Arm), Item := "InKind"]
  dd2[, c("Grace", "Size", "Item") := 
    .(factor(Grace), factor(Size, levels = c("LargeSize", "SmallSize")), 
      factor(Item))]
  dd2 <- data.table(dd2, 
    makeDummyFromFactor(dd2[, Size], reference = NULL),
    makeDummyFromFactor(dd2[, Grace], reference = NULL),
    makeDummyFromFactor(dd2[, Item], reference = NULL))
  # create demeaned dummies
  tobe.interacted <- c(ArmsC2, povertystatus, 
    c("SmallSize", "LargeSize", "WithoutGrace", "WithGrace", "Cash", "InKind"))
  for (k in tobe.interacted)
    dd2[, paste0("DemeanedDummy", k) := 
      eval(parse(text = 
        paste0("dummy", k)
      )) - 
      mean(
        eval(parse(text = 
          paste0("dummy", k)
        ))
        , na.rm = T)
    ]
  # Arm-Time interactions
  for (i in interterms) {
  # interterms are Time.T, T = 2, 3, 4
  # Demeand interactions between characteristics dummies (Arm, poverty, etc.) * time
    i1 <- unlist(strsplit(i, "\\."))
    i2 <- i1[2]; i1 <- i1[1] # i2 = T, i1 = Time
    i0 <- gsub("\\.", "", i)
    dd2[, (i) := as.numeric(eval(parse(text=i1)) == i2)]
    # DemeanedTimeT
    dd2[, paste0("Demeaned", i0) := 
      eval(parse(text=i)) - mean(eval(parse(text=i)), na.rm = T)] 
    # dummyArm.TimeX = DemeanedArm*DemeanedTimeX
    for (k in tobe.interacted)
      dd2[, paste0("dummy", k, ".", i0) := 
        eval(parse(text=paste0("Demeaned", i0))) * 
        eval(parse(text=paste0("DemeanedDummy", k)))]
    # undemeand (UD) interactions: UDdummyArm.TimeX
    for (k in tobe.interacted)
      dd2[, paste0("UDdummy", k, ".", i0) := 
        eval(parse(text=i)) * 
        eval(parse(text = paste0("dummy", k)))]
  }
  # Only for livestock to create demeand HadCows*Arm, HadCows*Arm*Time interactions 
  dd2[, .Arm := paste0(toupper(substr(Arm, 1, 1)), substr(Arm, 2, 100))]
  dd2[, .Arm := factor(.Arm, levels = ArmsC)]
  dd2[, .Arm := factor(.Arm, labels = ArmsC2)]
  if (grepl("^lvo$", datafiles[j])) {
    # demean HadCows
    dd2[, "DemeanedHadCows" := dummyHadCows - mean(dummyHadCows, na.rm = T)]
    dd2[, paste0("dummyHadCows.", "dummy", levels(dd2[, .Arm])) := 0L]
    dd2[, paste0(rep(paste0("dummyHadCows.", "dummy", levels(dd2[, .Arm])), 2),  
      rep(paste0(".Time", 3:4), each = 4)) := 0L]
    # HadCows * Arm, HadCows * Arm * Time
    for (a in c(levels(dd2[, .Arm]), levels(dd2[, Size]), levels(dd2[, Grace]), levels(dd2[, Item]))) {
      dd2[, paste0("dummyHadCows.dummy", a) := 
        eval(parse(text=paste0("DemeanedDummy", a, "*DemeanedHadCows")))]
      dd2[, paste0("dummyHadCows.dummy", a, ".Time", 3:4) := 
        .(eval(parse(text = paste0("dummyHadCows.dummy", a))) * DemeanedTime3,
          eval(parse(text = paste0("dummyHadCows.dummy", a))) * DemeanedTime4)]
    }
  }
  dd2[, .Arm := NULL]
  dd2[, grepout("Demea|i.group|group.id", colnames(dd2)) := NULL]
  Obs <- rbind(Obs, cbind(datafiles[j], dd2[, .(obs = .N), by = .(Arm, tee)]))
  assign(datafiles[j], dd2)
  saveRDS(dd2, paste0(pathsaveHere, DataFileNames[j], "Trimmed.rds"))
  fwrite(dd2, paste0(pathsaveHere, DataFileNames[j], "Trimmed.prn"), 
    sep = "\t", quote = F)
}

Check asset file entries. There are 797 households who respond at least once to asset questionnaire, but only 741 households respond at baseline (out of 800, response rate of 92.62%). Below displays the timing of first reponse on assets by HHs.

addmargins(table0(ass[o800 == 1L, .(Arm, survey, tee = 1:.N), 
  by = .(hhid)][tee == 1, .(survey, Arm)]))
      Arm
survey traditional large large grace cattle Sum
   1           184   189         189    179 741
   2            14    10          10     19  53
   3             0     1           0      2   3
   Sum         198   200         199    200 797

Among which, if we drop the sample in Traditional arm who receive the loan only twice, we have:

addmargins(table0(ass[o800 == 1L & !grepl("tw|dou", TradGroup) & 
  hhid %in% hhid[survey==1], 
  .(Arm, tee = 1:.N), by = .(survey, hhid)][tee == 1, .(survey, Arm)]))
      Arm
survey traditional large large grace cattle  Sum
   1           162   189         189    179  719
   2           153   181         161    169  664
   3           154   182         164    169  669
   4           135   182         161    156  634
   Sum         604   734         675    673 2686
Click here to see the code of tabulating number of entries.

Tabulate number of obs in each files. Read: c:/data/GUK/analysis/save/EstimationMemo/AllMeetingsRepaymentAdminData.rds.

s1 <- readRDS(paste0(pathsaveHere, "RosterAdminSchoolingData.rds"))
ar <- readRDS(paste0(pathsaveHere, "RosterAdminData.rds"))
arA <- readRDS(paste0(pathsaveHere, "AllMeetingsRosterAdminData.rds"))
ass <- readRDS(paste0(pathsaveHere, "AssetAdminData.rds"))
lvo <- readRDS(paste0(pathsaveHere, "LivestockAdminData.rds"))
lvoL <- readRDS(paste0(pathsaveHere, "LivestockLongAdminData.rds"))
lvp <- readRDS(paste0(pathsaveHere, "LivestockProductsAdminData.rds"))
lab <- readRDS(paste0(pathsaveHere, "LabourIncomeAdminData.rds"))
far <- readRDS(paste0(pathsaveHere, "FarmRevenueAdminData.rds"))
con <- readRDS(paste0(pathsaveHere, "ConsumptionAdminData.rds"))
obr <- readRDS(paste0(pathsaveHere, "OtherBorrowingAdminData.rds"))
shk <- readRDS(paste0(pathsaveHere, "Shocks.rds"))
ar[, teenum := 1:.N, by = .(hhid, survey)]
lab[, teenum := 1:.N, by = .(hhid, survey)]
con[, tee := (1:.N)+1, by = hhid]
s1[, tee := survey]
armtabs <- armtabs.o1600 <- NULL
for (i in 1:length(datafiles[-c(2, 6)])) {
  dx <- get(datafiles[-c(2, 6)][i])
  setorder(dx, hhid, survey, Year, Month)
  if (!any(grepl("^tee$", colnames(dx)))) dx[, tee := 1:.N, by = hhid]
  dx <- dx[tee < AttritIn, ]
  if (i != grep("con", datafiles[-c(2, 6)])) {
    for (j in 1:4) {
      armtabs <- rbind(armtabs,
         table0(dx[tee == j, Arm]))
      armtabs.o1600 <- rbind(armtabs.o1600,
         table0(dx[tee == j & o1600 == 1L, Arm]))
     }
  } else
    for (j in 2:4) {
      armtabs <- rbind(armtabs,
         table0(dx[tee == j & AttritIn != 2, Arm]))
      armtabs.o1600 <- rbind(armtabs.o1600,
         table0(dx[tee == j & AttritIn != 2 & o1600 == 1L, Arm]))
    }
}
armtabs <- data.table(armtabs)
armtabs[, total := rowSums(armtabs)]
armtabs <- data.table(
files = 
  paste0("\\makebox[1cm]{\\scriptsize ", 
    c(rep(datafiles[-c(2, grep("lvoL|con|obr", datafiles))], each = 4), 
      rep("con", each = 3),
      rep("obr", each = 3)
      )
      ,
    "}")
, 
rounds = 
  c(rep(1:4, length(datafiles)-4), 2:4, c(1, 2, 4))
, armtabs)
armtabs[-c(seq(1, nrow(armtabs)-3, 4), nrow(armtabs)-2), files := ""]
armtabs.o1600 <- data.table(armtabs.o1600)
armtabs.o1600[, total := rowSums(armtabs.o1600)]
armtabs.o1600 <- data.table(
files = 
  paste0("\\makebox[1cm]{\\scriptsize ", 
    c(rep(datafiles[-c(2, grep("lvoL|con|obr", datafiles))], each = 4), 
      rep("con", each = 3),
      rep("obr", each = 3)
      )
      ,
    "}")
, 
rounds = 
  c(rep(1:4, length(datafiles)-4), 2:4, c(1, 2, 4))
, armtabs.o1600)
armtabs.o1600[-c(seq(1, nrow(armtabs.o1600)-3, 4), 
  nrow(armtabs.o1600)-2), files := ""]
amt <- latextab(as.matrix(armtabs), 
  hleft = "\\scriptsize\\hfil$", 
  hcenter = c(1, rep(1.5, ncol(armtabs)-1)), hright = "$", 
  headercolor = "gray80", adjustlineskip = "-.4ex", 
  delimiterline= NULL,
  alternatecolor = "gray90")
amt.o1600 <- latextab(as.matrix(armtabs.o1600), 
  hleft = "\\scriptsize\\hfil$", 
  hcenter = c(1, rep(1.5, ncol(armtabs.o1600)-1)), hright = "$", 
  headercolor = "gray80", adjustlineskip = "-.4ex", 
  delimiterline= NULL, alternatecolor = "gray90")
write.tablev(amt,  
  paste0(pathsaveHere, "NumObsOriginalHHs_all.tex"), 
  colnamestrue = F)
write.tablev(amt.o1600,  
  paste0(pathsaveHere, "NumObsOriginalHHs_o1600.tex"),
  colnamestrue = F)

Tabulate number of obs in each files for original 800 households (before dropping 24 HHs in trad).

#### for (i in 1:length(DataFileNames))
####   assign(datafiles[i], readRDS(
####     paste0(pathsaveHere, DataFileNames[i], "InitialSample.rds")
####     ))
for (dtyp in c("AdminData", "Trimmed")) 
{
  if (dtyp == "AdminData") {
    s1 <- readRDS(paste0(pathsaveHere, "RosterAdminSchoolingData.rds"))
    ar <- readRDS(paste0(pathsaveHere, "Roster", dtyp, ".rds"))
    far <- readRDS(paste0(pathsaveHere, "FarmRevenue", dtyp, ".rds"))
  } else {
    s1 <- readRDS(paste0(pathsaveHere, "Schooling", dtyp, ".rds"))
    ar <- readRDS(paste0(pathsaveHere, "Repayment", dtyp, ".rds")) 
    far <- readRDS(paste0(pathsaveHere, "FarmIncome", dtyp, ".rds"))
  }
  ass <- readRDS(paste0(pathsaveHere, "Asset", dtyp, ".rds"))
  lvo <- readRDS(paste0(pathsaveHere, "Livestock", dtyp, ".rds"))
  lvp <- readRDS(paste0(pathsaveHere, "LivestockProducts", dtyp, ".rds"))
  lab <- readRDS(paste0(pathsaveHere, "LabourIncome", dtyp, ".rds"))
  con <- readRDS(paste0(pathsaveHere, "Consumption", dtyp, ".rds"))
  obr <- readRDS(paste0(pathsaveHere, "OtherBorrowing", dtyp, ".rds"))
  shk <- readRDS(paste0(pathsaveHere, "Shocks.rds"))
  lab[, teenum := 1:.N, by = .(hhid, survey)]
  con[, tee := (1:.N)+1, by = hhid]
  lab[, teenum := 1:.N, by = .(hhid, survey)]
  s1[, tee := survey]
  ar[, teenum := 1:.N, by = .(hhid, survey)]
  ar[, tee := survey]
  armtabs.o800 <- NULL
  for (i in 1:length(datafiles[-c(2, 6)])) {
    dx <- get(datafiles[-c(2, 6)][i])
    setorder(dx, hhid, survey, Year, Month)
    if (!any(grepl("^tee$", colnames(dx)))) dx[, tee := 1:.N, by = hhid]
    if (i == grep("^ar$", datafiles[-c(2, 6)])) {
      # ar has monthly data, keep only 1st month of each survey
      dx[, teeinsurvey := 1:.N, by = .(hhid, survey)]
      dx <- dx[teeinsurvey == 1, ] 
      dx[, teeinsurvey := NULL]
    }
    dx <- dx[tee < AttritIn, ]
    if (!(i %in% grep("con|obr", datafiles[-2]))) {
      for (j in 1:4) {
        armtabs.o800 <- rbind(armtabs.o800,
           table0(dx[tee == j & o800 == 1L, Arm])
           )
       }
    } else
    if (i == grep("con", datafiles[-c(2, 6)])) {
      for (j in 2:4) {
        armtabs.o800 <- rbind(armtabs.o800,
           table0(dx[tee == j & AttritIn != 2 & o800 == 1L, Arm])
           )
      }
    } else
      for (j in c(1, 2, 4)) {
        #dx[survey == 3, c("OutBal", "NetOutBal") := NA]
        armtabs.o800 <- rbind(armtabs.o800,
           table0(dx[survey == j & o800 == 1L, Arm])
           )
      }
  }
  armtabs.o800 <- data.table(armtabs.o800)
  armtabs.o800[, total := rowSums(armtabs.o800)]
  armtabs.o800 <- data.table(
    files = 
      paste0("\\makebox[1cm]{\\scriptsize ", 
        c(rep(datafiles[-c(2, grep("lvoL|con|obr", datafiles))], each = 4), 
          rep("con", each = 3),
          rep("obr", each = 3)
          )
          ,
        "}")
    , 
    rounds = 
      c(rep(1:4, length(datafiles)-4), 2:4, c(1, 2, 4))
    , armtabs.o800)
  armtabs.o800[-c(seq(1, nrow(armtabs.o800)-3, 4), 
    nrow(armtabs.o800)-2), files := ""]
  assign(paste0("a8", dtyp), armtabs.o800)
  amt.o800 <- latextab(as.matrix(armtabs.o800), 
    hleft = "\\scriptsize\\hfil$", 
    hcenter = c(1, rep(1.5, ncol(armtabs.o800)-1)), 
    hright = "$",  headercolor = "gray80", 
    adjustlineskip = "-.4ex", delimiterline= NULL,
    alternatecolor = "gray90")
  write.tablev(amt.o800,  
    paste0(pathsaveHere, "NumObsOriginalHHs", dtyp, "_o800.tex"),
    colnamestrue = F)
}

Above gives LaTeX tables that summarise data trimming results:

NumObsOriginalHHs_all.tex, NumObsOriginalHHs_o1600.tex, NumObsOriginalHHsAdminData_o800.tex, NumObsOriginalHHsTrimmed_o800.tex

Number of observations in files used for estimation.

     files rounds traditional large large grace cattle total
    <char>  <int>       <int> <int>       <int>  <int> <int>
 1:     s1      1         232   246         251    235   964
 2:             2         180   197         177    191   745
 3:             3         164   185         165    173   687
 4:             4         134   171         147    143   595
 5:     ar      1         200   200         200    200   800
 6:             2         190   191         172    190   743
 7:             3         188   193         174    190   745
 8:             4         168   192         171    177   708
 9:    ass      1         198   200         199    200   797
10:             2         190   194         177    195   756
11:             3         186   191         174    188   739
12:             4         154   179         155    151   639
13:    lvo      1         199   200         189    199   787
14:             2         186   194         175    188   743
15:             3         177   188         168    180   713
16:             4         135   166         142    160   603
17:    lvp      1         199   200         200    200   799
18:             2         192   195         177    195   759
19:             3         188   193         174    190   745
20:             4         168   192         171    177   708
21:    lab      1         199   200         200    200   799
22:             2         192   195         177    195   759
23:             3         188   193         174    190   745
24:             4         168   191         170    175   704
25:    far      1          12    46          24     25   107
26:             2           4    26          13     10    53
27:             3           2     9           8      4    23
28:             4           1     1           1      1     4
29:    con      2         192   194         177    195   758
30:             3         187   191         174    190   742
31:             4         167   188         165    172   692
32:    obr      1         199   199         199    199   796
33:             2         190   191         171    190   742
34:             4         168   192         171    177   708
     files rounds traditional large large grace cattle total

Schooling information needs a separate cleaning process as we need to work on housheold member levels and drop observations with no schooling information. To do so, we create a variable SchPattern that shows schooling pattern of individuals in a separate file ReadTrimSchoolingOriginalHHsFDData2.R. It takes enrollment = 0, 1, NA, transforms them to 0, 1, n and paste across 4 periods for each individuals, so they will have values of 1111, 1011, n100, etc.

Enrollment pattern in original schooling panel. `n’ indicates NA (either attrition or not reported).

table0(s.1x[tee == 1, .(ObPattern, SchPattern)])
         SchPattern
ObPattern 0000 0001 000n 0011 001n 00nn 010n 0111 011n 01nn 0nnn 1000 1001 100n 1011 101n 10nn 1100
     0111    0    0    0    0    0    0    0    0    2    1    2    0    0    0    0    0    0    0
     1000    0    0    0    0    0    0    0    0    0    0   32    0    0    0    0    0    0    0
     1010    0    0    0    0    0    1    0    0    0    0    2    0    0    0    0    0    0    0
     1011    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0
     1100    0    0    0    0    0    0    0    0    0    3    1    0    0    0    0    0    0    0
     1110    0    0    5    0    2    1    0    0    3    0    2    0    0    1    0    1    0    0
     1111   21    2   21   12    2   28    1   83    8    6   68    5    1    4    6    3   10    8
         SchPattern
ObPattern 1101 110n 1110 1111 111n 11n1 11nn 1nnn
     0111    0    0    0    0    6    0    0    1
     1000    0    0    0    0    0    0    0   22
     1010    0    0    0    0    0    0    1    2
     1011    0    0    0    0    0    0    0    0
     1100    0    0    0    0    0    0    6    0
     1110    0    0    0    0   25    0    3    0
     1111    1    9    3  397   41    1   29   42
Click here to see the number of entries before and after dropping nnn.

Left panel is before, right panel is after, dropping nnn.

cbind(table0(s.1x[, .(tee, Arm)]), 
  table0(s1x[, .(tee, Arm)]))
  traditional large large grace cattle traditional large large grace cattle
1         205   246         251    235         166   208         186    203
2         166   208         186    203         166   208         186    203
3         148   184         168    173         148   184         168    173
4         113   161         135    131         113   161         135    131

Schooling data s.1x has 2913 rows. Drop 174 observations with nnn in SchPattern. After dropping these observations, we rename the data as s1x.

With OLS, 89, 135, 539 individuals are repeatedly observed for 2, 3, 4 times, respectively. With FD, s1x is reduced to 1837 rows after first-differencing with 75, 129, 499 individuals with repeatedly observed for 1, 2, 3 times, respectively. Individuals with NAs in Enrolled: 0 obs for s1x.

Check missingness in schooling level (junior, high) information.

table0(apply(s1x[, .(dummyJunior, dummyHigh)], 1, sum))
x
   0    1 
1575 1164 

Drop 1575 observations without school level information.

s1x <- s1x[apply(s1x[, .(dummyJunior, dummyHigh)], 1, sum) == 1, ]
ds1xd[, grepout("^Tee$", colnames(ds1xd)) := NULL]

Creating ’EachFileName’InitialSample.rds files to be used in estimation

InitialSample is produced by dropping 24 HHs of traditional arm (who received only 2 loans [twice and double in TradGroup]) from Trimmed Sample. This is done for all files except Repayment.

for (i in (1:length(DataFileNames))[-c(3)])
  assign(datafiles[i], readRDS(
    paste0(pathsaveHere, DataFileNames[i], "Trimmed.rds")
    ))
for (i in (1:length(DataFileNames))[-c(3)]) {
  dd <- readRDS(paste0(pathsaveHere, DataFileNames[i], "Trimmed.rds"))
  dd <- dd[!grepl("tw|dou", TradGroup), ]
  saveRDS(dd, paste0(pathsaveHere, DataFileNames[i], "InitialSample.rds"))
  write.tablev(dd, paste0(pathsaveHere, DataFileNames[i], "InitialSample.prn")
    , colnamestrue = F)
}
For remaining Repayment, read RepaymentTrimmed.rds, drop 24 obs, and save as RepaymentInitialSample.rds.
Click here to see before and after dropping 24 obs.
             Only2Loans
Arm           FALSE TRUE Sum
  traditional   176   24 200
  large         200    0 200
  large grace   200    0 200
  cattle        200    0 200
  Sum           776   24 800
       traditional large large grace cattle Sum
before         200   200         200    200 800
after          176   200         200    200 776
ar <- arT[!grepl("tw|dou", TradGroup), ]
saveRDS(ar, paste0(pathsaveHere, DataFileNames[3], "InitialSample.rds"))
Click here to see code of further corrections (repay before disbursement is loan year = -1).

Correct NAs in LoanYear to -1 when members start repayment before disbursement.

#### roster file has wrong tee numbering, Redefine as TEE.
setkey(ar, hhid, mid, Date)
ar[, TEE := 1:.N, by = .(hhid, mid)]
setkey(ar, hhid, Date, mid)
arA[, tee := NULL]
arA[, tee := as.integer(1:.N), by = hhid]
#### in ar: Date is NA and TEE == 1. Produced by forcing TEE == 1 
#### to added to roster file.
#### Set LoanYear to 1
ar[TEE == 1 & is.na(Date) & is.na(LoanYear), LoanYear := 1]
#### Some members start repayment before loan disbursement.
#### Loan year is NA for such cases. 
#### Define LYear that includes LoanYear = -1 or 5.
#### SO: https://stackoverflow.com/a/1995984
elapsed_months <- function(end_date, start_date) {
    ed <- as.POSIXlt(end_date)
    sd <- as.POSIXlt(start_date)
    12 * (ed$year - sd$year) + (ed$mon - sd$mon)
}
for (aobj in c("ar", "arA")) {
  aob <- get(aobj)
  if (!any(grepl("LYear$", colnames(aob))))
  {
    aob[, LYear := LoanYear]
    aob[Date < DisDate1, LYear := -1]
    DueDate <- as.POSIXlt(aob[, DisDate1])
    DueDate$mon <- DueDate$mon + 48
    aob[elapsed_months(Date, DisDate1) <= 48 & 
      elapsed_months(Date, DisDate1) > 36, LYear := 4]
    aob[Date > DueDate, LYear := 5]
    assign(aobj, aob)
  }
}
#### display NAs in LYear while repaying
tb <- table0(ar[o800 == 1L & tee == 1L, .(BStatus, Arm)])
tb1 <- cbind(tb, total = apply(tb, 1, sum))
tb <- table0(ar[tee == 1L, .(BStatus, Arm)])
tb2 <- cbind(tb, total = apply(tb, 1, sum))
tb <- cbind(tb1, tb2)
tb <- rbind(tb, total = apply(tb, 2, sum))
tb <- as.matrix(cbind(
  paste0("\\makebox[2.5cm]{\\scriptsize\\hfill ", rownames(tb), "}"), tb))
IniSampByArmar <- latextab(tb,
  hleft = "\\scriptsize\\hfil$", hcenter = c(2.5, rep(.95, ncol(tb)-1)), 
  hright = "$", 
  headercolor = "gray80", adjustlineskip = "-.2ex", delimiterline= NULL,
  alternatecolor = "gray90",
  addseparatingcols = 5, separatingcolwidth = .2,
  separatingcoltitle = c("initial sample", "all sample"),
  addsubcoltitlehere = T)
write.tablev(IniSampByArmar,  
  paste0(pathsaveHere, "InitialSampleSizeByArmInAr.tex")
  , colnamestrue = F)

Tabulation of membership of InitialSample by arms using arA.

tb <- table0(arA[o800 == 1L & tee == 1L & !grepl("tw|dou", TradGroup), 
  .(BStatus, Arm)])
tb1 <- cbind(tb, total = apply(tb, 1, sum))
tb <- table0(arA[tee == 1L & !grepl("tw|dou", TradGroup), .(BStatus, Arm)])
tb2 <- cbind(tb, total = apply(tb, 1, sum))
tb <- cbind(tb1, tb2)
tb <- rbind(tb, total = apply(tb, 2, sum))
tb <- as.matrix(cbind(
  paste0("\\makebox[2.5cm]{\\scriptsize\\hfill ", rownames(tb), "}"), tb))
IniSampByArmar <- latextab(tb,
  hleft = "\\scriptsize\\hfil$", hcenter = c(2.5, rep(.95, ncol(tb)-1)), 
  hright = "$", 
  headercolor = "gray80", adjustlineskip = "-.2ex", delimiterline= NULL,
  alternatecolor = "gray90",
  addseparatingcols = 5, separatingcolwidth = .2,
  separatingcoltitle = c("initial sample", "all sample"),
  addsubcoltitlehere = T)
write.tablev(IniSampByArmar,  
  paste0(pathsaveHere, "InitialSampleSizeByArmInArA.tex")
  , colnamestrue = F)

Descriptive statistics

Click here to see code of descriptive statistics.
asv <- readRDS(paste0(pathsaveHere, "DestatData.rds"))
arms <- c("traditional", "large", "large grace", "cow")
armsC <- c("traditional", "large", "large grace", "cattle")
ArmsC <- c("Traditional", "Large", "Large grace", "Cattle")
MeanAndStd0 <- function(x, NARM = T) {
  nx <- names(x)
  if (is.null(dim(x))) x <- matrix(x)
  ms <- c(apply(x, 2, mean, na.rm = NARM), 
    apply(x, 2, function(z) var(z, na.rm = NARM)^.5))
  names(ms) <- paste0(nx, rep(c(".mean", ".std"), each = ncol(x)))
  return(ms) 
}
#### destat for main text
iiM <- c("HeadLiteracy", "HeadAge", "HHsize", "FloodInRd1", 
  "NLHAssetAmount",  "PAssetAmount", 
  "TotalImputedValue", "NumCows", 
  "NetValue", "NetBroadValue",
  "Attrited", "IRejected", "GRejected", "Active",
  "RiskPrefVal", "TimePref1Val", "TimePref2Val", "PresentBias")
#### FloodInRd1 has NAs, all entries are NAs for 5 HHs
dm <- asv[, 
  lapply(.SD, sum), .SDcols = iiM, by = Arm]
desMain <- asv[, 
  lapply(.SD, MeanAndStd0), .SDcols = iiM, by = Arm]
desMain2 <- asv[, 
  lapply(.SD, MeanAndStd0), .SDcols = iiM]
#### Kruskal-Wallis equality of location between groups 
#### without normality and equal variance assumptions
kw <- lapply(iiM, function(x) kruskal.test(
  formula(paste0(x , "~ Arm")), data = asv))
kw <- lapply(kw, function(x) 
  formatC((x$p.value)*100, digits = 2, format = "f"))
#### ANOVA equality of location between groups under normality 
#### and equal variance assumptions
ano <- lapply(iiM, function(x) summary(aov(
  formula(paste0(x , "~ Arm")), data = asv)))
ano <- lapply(ano, function(x) 
  formatC((x[[1]]$P[1])*100, digits = 2, format = "f"))
#### Shapiro-Wilks tests for normality
sha <- lapply(iiM, function(x) 
  shapiro.test(unlist(asv[, x, with = F]))$p.value)
sha <- lapply(sha, function(x) 
  formatC(x*100, digits = 2, format = "f"))
#### Flinger-Killeen's test of equal variance robust to nonnormality
eqv <- lapply(iiM, function(x) fligner.test(
  formula(paste0(x , "~ Arm")), data = asv)$p.value)
eqv <- lapply(eqv, function(x) 
  formatC(x*100, digits = 2, format = "f"))
#### N
desMainN <- asv[, (N = .N), by = Arm]
setnames(desMainN, "V1", "N")
desMainN <- rbind(desMainN, 
  list(Arm = "overall", N = sum(desMainN[, N])))
desMain2[, Arm := "overall"]
desMain <- rbindlist(list(desMain, desMain2), use.names = T)
ascols <- c("NLHAssetAmount", "PAssetAmount", 
  "TotalImputedValue", "NetValue", "NetBroadValue",
  "RiskPrefVal", "TimePref1Val", "TimePref2Val")
desMain[, (ascols) := lapply(.SD, round, 0), .SDcols = ascols]
othecols <- c("HeadLiteracy", "HeadAge", "HHsize", 
  "FloodInRd1", "NumCows", "Attrited", 
  "IRejected", "GRejected", "Active", "PresentBias")
desMain[, (othecols) := lapply(.SD, round, 3), .SDcols = othecols]
desMmean <- desMain[seq(1, nrow(desMain), 2), ]
desMstd <- desMain[-seq(1, nrow(desMain), 2), ]
setkey(desMmean, Arm)
setkey(desMstd, Arm)
desMmean <- data.table(variables = colnames(desMmean), t(desMmean))
setnames(desMmean, c("variables", as.character(desMmean[1, -1])))
desMmean <- desMmean[-1, ]
desMstd <- data.table(variables = colnames(desMstd), t(desMstd))
setnames(desMstd, c("variables", as.character(desMstd[1, -1])))
desMstd <- desMstd[-1, ]
armso <- c(armsC, "overall")
desMstd[, (armso) := lapply(.SD, function(x) 
  paste0("(", x, ")")), .SDcols = armso]
setkey(desMmean, variables, physical = F)
setkey(desMstd, variables, physical = F)
desM <- rbind(desMmean, desMstd)
setkey(desM, variables)
rnum <- NULL
for (i in 1:nrow(desMmean)) 
  rnum <- c(rnum, 
    grep(paste0("^", desMmean[i, variables]), desM[, variables]))
desM <- desM[rnum, ]
#### change Active to non-attriting borrowers
desM[grepl("Active", variables), 
  variables := "Non-attriting borrowers"]
#### add N
desMainN2 <- data.table(t(desMainN[, N]))
setnames(desMainN2, as.character(desMainN[, Arm]))
desMainN2[, variables := "N"]
desM <- rbindlist(list(desM, desMainN2), use.names = T, fill = T)
desM[seq(2, nrow(desM), 2), variables := ""]
desM[seq(1, nrow(desM), 2), variables := 
  paste0("\`", variables, "`")]
setnames(desM, c("variables", armsC, "overall"), 
  c("Variable", ArmsC, "Overall"))
#### desM[, ANOVA := c(unlist(lapply(ano, function(x) c(x, ""))), "")]
#### desM[, "K-W" := c(unlist(lapply(kw, function(x) c(x, ""))), "")]
#### desM[, "S-W" := c(unlist(lapply(sha, function(x) c(x, ""))), "")]
#### desM[, "F-K" := c(unlist(lapply(eqv, function(x) c(x, ""))), "")]
#### substitute covariate names 
source(paste0(pathprogram, "SubstTableANCOVA.R"))
rn <- rn2 <- as.character(unlist(desM[, 1]))
for (i in 1:nrow(subst.tableA)) 
  rn <- gsub(subst.tableA[i, 1], subst.tableA[i, 2], rn)
#### for LaTeX
rn <- gsub("\\{", "{(", rn[seq(1, length(rn), 2)])
rn <- gsub("\\}", ")}", rn)
rn <- gsub("textsf", "textrm", rn)
rn <- gsub("\\{", "\\{\\\\scriptsize ", rn)
rn <- c(t(cbind(rn2[seq(1, length(rn2), 2)], rn)))
rn <- rn[-length(rn)]
desM[, Variable := rn] 
DestatMainByArm <- latextab(as.matrix(desM),
  hleft = c("\\scriptsize\\hfill ", 
    rep("\\scriptsize\\hfil$", ncol(desM)-1)), 
  hcenter = c(3.5, rep(1.05, ncol(desM)-1)), 
  hright = c("", rep("$", ncol(desM)-1)), 
  headercolor = "gray80", adjustlineskip = "-.4ex", 
  delimiterline= NULL, alternatecolor2 = "gray90")
write.tablev(DestatMainByArm,  
  paste0(pathsaveHere, "DestatMainByArm.tex")
  , colnamestrue = F)
#### For html
library(kableExtra)
rn2 <- gsub("\\\\textsf\\{(.*?)\\}", "\\1", rn2)
for (i in 1:nrow(subst.tableA)) 
  rn2 <- gsub(subst.tableA[i, 1], subst.tableA[i, 2], rn2)
desM[, Variable := rn2] 
#### The problem is that (31) is one of the ways Pandoc Markdown 
#### uses to indicate an ordered list. To disable this, 
#### you can escape the parenthesis using a backslash 
#### (which would have to be a double backslash in an R string), 
#### e.g. "(31)" would become "\\(31)".
#### https://stackoverflow.com/a/59644337
desM <- sapply(desM, function(x) gsub("\\(", "\\\\(", x))
ktft <-   paste("Source: Estimated with GUK administrative", 
    "and survey data at the period 2. Survey respondents include", 
    "nonparticipants to the experiments.\\n",
    "Notes: 1. Information of original 800 households.",
    "Values are means, values in brackets are standard",
    "deviations. 2. `HeadLiteracy`, `HeadAge` are literacy",
    "and ages of household heads.",
    "`HHsize` is total number of household members. `FloodInRd1`", 
    "is flood exposure at period 2. `NLHAssetAmount`",
    "is non-land household", 
    "asset holding value, `PAssetAmount` is productive",
    "asset holding value,",
    "`TotalImputedAmount` is imputed value of livestock",
    "holding. `NumCows` is cattle holding per household.",
    "`NetValue` is net asset values",
    "per housheold for asset items observed in all 4 rounds given by",
    "`NLHAssetAmount`+`PAssetAmount`+",
    "`TotalImputedAmount` - total debt.",
    "`NetBroadValue` is net asset values per housheold",
    "for all asset items.",
    "All asset values are expressed in BDT. `Attrited`",
    "indicates attrition rates",
    "in the household survey, and `GRejected` and", 
    "`IRejected` show group",
    "rejection rates and individual rejection rates to",
    "the lending program.",
    "`Active` indicates the nonattrited borrower ratios.",
    "Because attrition",
    "and rejection are separate events, a household can", 
    "reject and attrit, so active members $\\geqslant$", 
    "total - (rejected members + attrited members).",
    PrefTestsDefinitions1)
ktft <-   paste("Source: Estimated with GUK administrative", 
    "and survey data at the period 2. Survey respondents include", 
    "nonparticipants to the experiments.\\n",
    "Notes: 1. Information of original 800 households.",
    "Values are means, values in brackets are standard",
    "deviations. 2. `Head literate`, `Head age` are literacy",
    "and ages of household heads.",
    "`Household size` is total number of household members. `Flood in round 1`", 
    "is flood exposure at period 2. `HAssetAmount`",
    "is household's non-production related", 
    "asset holding value excluding livestock, `PAssetAmount` is production related",
    "asset holding value excluding livestock,",
    "`Total livestock value` is imputed value of livestock using median prices",
    "holding. `NumCows` is cattle holding per household.",
    "`Net asset value` is net assets value",
    "per housheold for asset items observed in all 4 rounds given by",
    "`Household asset value`+`Production asset value`+",
    "`Total livestock value` - total debts.",
    "`Net broad asset value` is net asset values per housheold",
    "for all asset items.",
    "All asset values are expressed in BDT. `Attrited`",
    "indicates attrition rates",
    "in the household survey, and `Individually rejected` and", 
    "`Group rejected` show individual",
    "rejection rates and group rejection rates to",
    "the lending program.",
    "`Non attriting borrowers` indicates the non-attrited borrower ratios.",
    "Because attrition",
    "and rejection are separate events, a household can", 
    "reject and attrit, so active members $\\geqslant$", 
    "total - (rejected members + attrited members).",
    PrefTestsDefinitions1)
kt <- kable(desM, format = "html", align = c("r", rep("c", 5)))
#### kt <- kableExtra::footnote(kt, general = ktft)
kt <- column_spec(kt, 1, width = "4cm; min-width:4cm;")
kt <- column_spec(kt, 2:6, width = "2.5cm; min-width:2.5cm;")
#### kt <- kable_classic(kt, html_font = "Cambria")
Descriptive statistics
Variable Traditional Large Large grace Cattle Overall
Head literate 0.097 0.110 0.105 0.155 0.117
(0.296) (0.314) (0.307) (0.363) (0.322)
Head age 38.429 37.465 38.409 38.015 38.067
(10.115) (10.165) ( 9.271) (10.746) (10.075)
Household size 4.091 4.295 4.245 4.115 4.189
(1.447) (1.506) (1.492) (1.368) (1.454)
Flood in round 1 0.463 0.618 0.407 0.497 0.497
(0.500) (0.487) (0.493) (0.501) (0.500)
Household asset value </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 1428 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 1268 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 1317 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 1534 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 1383 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \( 922) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \( 762) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \( 698) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(1174) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \( 910) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Productive asset value 1020 1234 2022 1027 1332
(1724) (2330) (9364) (2572) (5118)
Livestock value </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 4343 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 6500 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 5397 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 4121 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 5111 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(11116) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(14725) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(13147) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(10304) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(12490) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Number of cattle</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.217 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.325 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.270 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.206 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.256 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.556) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.736) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.657) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.515) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.624) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">NetValue</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 8011 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 10074 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 9671 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 5649 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 8375 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(14877) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(16402) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(21510) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(11752) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(16557) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">NetBroad Value</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 9012 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 10830 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 9931 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 6962 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 9206 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(15030) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(16604) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(21371) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(12878) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(16784) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Attrited</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.182 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.040 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.145 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.115 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.119 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.387) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.196) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.353) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.320) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.323) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Individually rejected</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.176 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.045 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.065 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.185 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.116 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.382) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.208) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.247) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.389) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.320) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Group rejected</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.227 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.100 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.050 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.000 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.090 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.420) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.301) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.218) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.000) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.287) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Non-attriting borrowers</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.472 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.820 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.800 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.735 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.714 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.501) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.385) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.401) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.442) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.452) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Risk preference value</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 115 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 108 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 113 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 110 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 111 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(31) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(32) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(37) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(32) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(33) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Time preference value 1</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 374 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 373 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 376 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 407 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 383 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(132) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(153) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(147) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(142) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(144) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Time preference value 2</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 483 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 485 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 476 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 512 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 490 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(127) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(137) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(155) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(121) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(136) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">Present bias</td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.470 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.450 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.480 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.458 </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> 0.464 </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; "> </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.501) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.499) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.501) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.500) </td> <td style="text-align:center;width: 2.5cm; min-width:2.5cm;; "> \(0.499) </td> </tr> <tr> <td style="text-align:right;width: 4cm; min-width:4cm;; ">N` 176 200 200 200 776

Note: Source: Estimated with GUK administrative and survey data at the period 2. Survey respondents include nonparticipants to the experiments.Notes: 1. Information of original 800 households. Values are means, values in brackets are standard deviations. 2. Head literate, Head age are literacy and ages of household heads. Household size is total number of household members. Flood in round 1 is flood exposure at period 2. HAssetAmount is household’s non-production related asset holding value excluding livestock, PAssetAmount is production related asset holding value excluding livestock, Total livestock value is imputed value of livestock using median prices holding. NumCows is cattle holding per household. Net asset value is net assets value per housheold for asset items observed in all 4 rounds given by Household asset value+Production asset value+ Total livestock value - total debts. Net broad asset value is net asset values per housheold for all asset items. All asset values are expressed in BDT. Attrited indicates attrition rates in the household survey, and Individually rejected and Group rejected show individual rejection rates and group rejection rates to the lending program. Non attriting borrowers indicates the non-attrited borrower ratios. Because attrition and rejection are separate events, a household can reject and attrit, so active members \(\geqslant\) total - (rejected members + attrited members). Risk preference is the respondent’s choice of the acceptable minimum excess monetary value of the risky option over a certainty option. Lower values indicate a greater risk tolerance. Time preference 1 is the respondent’s choice of the acceptable minimum excess monetary value in 3 months that is no smaller than present monetary benefit, and Time preference 2 is the the minimum excess value in 1 year and 3 months that is no smaller than monetary benefits of 1 year from now. Lower values indicate a greater patience. If a respondent’s Time preference 1 is greater than Time preference 2, the respondent is considered to be present-biased. Present bias is an indicator function that takes the value of 1 if the respondent is considered to be present-biased, 0 otherwise.

Anomalies in asset entries

Asset entries are consistently observed only for selected items. We cosider entries as anomalous if between period difference in total asset value is more than BDT 50000. As shown below, we have one household with anomalous asset entries.

  • We could have ruled this out by winsorising the asset items, but we do not do so.
  • We use narrowly defined assets that are observed in all rounds.
  • We use broadly defined assets that use all asset items with no winsorising in a robustness check.

If we winsorise cassette players, radios, and bicycles, there is no HH with anomalous asset values (changes in narrow net asset values \(<-50000\)).

Click to see the code and anomalous entries.
xpa <- readRDS(paste0(path1234, "ProdAssetsCleaned.rds"))
xha <- readRDS(paste0(path1234, "HHAssetsCleaned.rds"))
xas2 <- readRDS(paste0(path1234, "MergedAssetsCleaned.rds"))
#### Trimmed data are before dropping 26 HHs.
ar <- readRDS(paste0(pathsaveHere, 
  DataFileNames[3], "Trimmed.rds"))
completeAsset <- readRDS(paste0(path1234, 
  "ListOfCompleteAssetsInAllRounds.rds"))
#### asset data anomalous HHs
xha[, DNLHAval := c(NA, diff(NLHAssetAmount)), by = hhid]
xha[, DvalAnomalous := hhid %in% hhid[DNLHAval < -50000] ]
#### attaches Arm and limits obs to o800 == 1L
ar2 <- unique(ar[o800 == 1L, .(Arm, hhid)]) 
#### HHs with anomalous data entries: hhid = 8169717 (trad)
da50K <- unique(xha[(DvalAnomalous) & 
  hhid %in% hhid[amount > 50000] & hhid %in% ar2[, hhid], hhid])
setkey(ar2, hhid)
setkey(xha, hhid)
xha2 <- xha[ar2]
for (h in da50K)
  print(xha2[hhid == h, .(Arm, hhid, t=survey, type, amount, 
    H=NLHAssetAmount, BH=BroadNLHAssetAmount, NLHAssetNum)])
Key: <hhid>
            Arm    hhid     t             type amount     H     BH NLHAssetNum
         <fctr>   <num> <num>           <char>  <int> <int>  <int>       <int>
 1: traditional 8169717     1         tubewell   1500  1500   1500           1
 2: traditional 8169717     2         tubewell   1600  1600   7600           1
 3: traditional 8169717     2 residential land   6000  1600   7600           1
 4: traditional 8169717     3         tubewell   1200 82600 121600           3
 5: traditional 8169717     3  almirah/cabinet   2600 82600 121600           3
 6: traditional 8169717     3          jewelry    400 82600 121600           3
 7: traditional 8169717     3     mobile phone   1400 82600 121600           3
 8: traditional 8169717     3 residential land  36000 82600 121600           3
 9: traditional 8169717     3     rickshaw/van  80000 82600 121600           3
10: traditional 8169717     4         tubewell    400  3300  46400           3
11: traditional 8169717     4  almirah/cabinet   2500  3300  46400           3
12: traditional 8169717     4          jewelry    600  3300  46400           3
13: traditional 8169717     4 residential land  40000  3300  46400           3
14: traditional 8169717     4          bicycle   2500  3300  46400           3
15: traditional 8169717     4     mobile phone    400  3300  46400           3

Estimation

Estimation uses initial sample HHs (800 households less the members receiving less than 3 loans in Traditional arm).

ANCOVA is a model that controls for the preexisting differences by including initial values of \(y\) as a covariate (usually a continuous variable which can be seen as a nuissance) to the estimated impacts of a categorical variable (treated/control). We use ANCOVA because it is more effcient than DID if randomisation is successful.

In the estimation, there are 7 “reg types” in estimation, which are:

Within each type, there are 5 regression specifications. In our analysis, we mainly rely on “Time varying by arm,” and refer to “Time varying by functional attribute” whenever necessary.

Schooling

In enrollment regressions, initial enrollment is defined only for school age children at the initial period.

Enrollment pattern in schooling panel. n indicates NA (either attrition or not reported). Schooling data has 2913 rows. Drop 174 observations with nnn in SchPattern. With OLS, 89, 135, 539 individuals are repeatedly observed for 2, 3, 4 times, respectively. Number of individuals with NAs in Enrolled: 0 obs. ANCOVA is estimated with data after dropping observations with nnn in SchPattern.

source(paste0(pathprogram, "ReadTrimSchoolingANCOVA.R"))
FileName <- "Schooling"
FileNameHeader <- c("", "Attributes", "PovertyStatus",
  "TimeVarying", "TimeVaryingAttributes",
  "TimeVaryingPovertyStatus", "TimeVaryingPovertyStatusAttributes")
regsuffixes <- c("", "a", "P", "T", "Ta", "TP", "TPa")
regsuffixes <- c("", "a", "P", "T", "Ta")
listheader <- paste0("sc", regsuffixes)
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
source(paste0(pathprogram, "SchoolingCovariateSelectionANCOVA3.R"))
jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
Regressands <- rep("Enrolled", jay)
DataToUse1 <- DataToUse2 <- rep("s1", jay)
Addseparatingcols = NULL; Separatingcolwidth = .2
dig.depmean <- 2
AddMeanStdColumn <- UseRawDataForDestat <- T
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
Click here to see the table of time varying schooling impacts by arm.

Enrolled0 is the baseline dependent variable of ANCOVA, ChilAgeOrderAtRd1, Household size0 are baseline covariates. (1) is OLS, (2)-(5) are ANCOVA estimates.

Schooling,

covariates mean/std 1 2 3 4 5 6
(Intercept) 0.91 0.69 0.75 0.89 0.73 0.86
(0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Secondary 0.338 -0.11 -0.09 -0.11 -0.09
(0.47) (0.0) (0.0) (0.0) (0.0)
College 0.172 -0.21 -0.18 -0.20 -0.18
(0.38) (0.0) (0.0) (0.0) (0.0)
Large 0.272 -0.03 -0.04 -0.04 -0.04 -0.04 -0.04
(0.44) (38.5) (20.0) (15.0) (13.6) (16.8) (14.3)
LargeGrace 0.247 -0.04 -0.05 -0.04 -0.05 -0.04 -0.04
(0.43) (21.6) (12.1) (12.5) (9.7) (13.4) (11.3)
Cattle 0.257 -0.05 -0.06 -0.06 -0.06 -0.06 -0.05
(0.44) (16.7) (5.5) (2.3) (3.1) (2.7) (3.9)
Large \(\times\) Secondary 0.085 -0.01 0.00 -0.00 0.01
(0.28) (90.6) (92.5) (95.1) (89.4)
LargeGrace \(\times\) Secondary 0.083 -0.07 -0.08 -0.07 -0.08
(0.28) (12.8) (11.6) (15.5) (11.0)
Cattle \(\times\) Secondary 0.088 -0.01 -0.01 -0.01 -0.01
(0.28) (77.3) (80.0) (82.5) (83.0)
Large \(\times\) College 0.049 0.03 0.04 0.04 0.06
(0.22) (68.1) (58.4) (51.3) (34.0)
LargeGrace \(\times\) College 0.049 -0.02 -0.04 -0.02 -0.03
(0.22) (72.4) (59.1) (78.6) (68.8)
Cattle \(\times\) College 0.035 -0.11 -0.13 -0.07 -0.09
(0.18) (16.2) (8.3) (28.4) (19.7)
Female 0.450 0.05 0.05
(0.50) (2.9) (4.9)
Secondary \(\times\) Female 0.152 0.08 0.08
(0.36) (0.4) (0.9)
College \(\times\) Female 0.059 0.12 0.10
(0.24) (2.0) (6.4)
Large \(\times\) Female 0.121 0.01 0.03
(0.33) (92.1) (64.1)
LargeGrace \(\times\) Female 0.114 0.08 0.06
(0.32) (10.5) (19.0)
Cattle \(\times\) Female 0.114 0.07 0.08
(0.32) (16.0) (11.3)
Large \(\times\) Secondary \(\times\) Female 0.041 -0.09 -0.11
(0.20) (34.0) (20.0)
LargeGrace \(\times\) Secondary \(\times\) Female 0.036 0.10 0.12
(0.19) (26.7) (18.8)
Cattle \(\times\) Secondary \(\times\) Female 0.037 0.05 0.06
(0.19) (58.0) (52.9)
Large \(\times\) College \(\times\) Female 0.016 0.08 0.11
(0.12) (58.1) (46.2)
LargeGrace \(\times\) College \(\times\) Female 0.018 -0.03 0.01
(0.13) (84.5) (95.2)
Cattle \(\times\) College \(\times\) Female 0.010 0.18 0.17
(0.10) (25.5) (30.8)
EldestSon 0.267 0.00 0.04
(0.44) (89.8) (31.8)
EldestDaughter 0.188 0.04 0.01
(0.39) (23.9) (77.2)
Flood in round 1 0.464 -0.04 -0.05
(0.50) (4.8) (3.6)
Head literate0 0.108 0.06 0.06
(0.31) (1.8) (1.8)
Head age0 39.153 -0.00 -0.00
(7.38) (7.7) (7.6)
Enrolled0 0.760 0.29 0.32 0.29 0.31 0.29
(0.43) (0.0) (0.0) (0.0) (0.0) (0.0)
ChildAgeOrderAtRd1 1.826 0.02 0.02
(0.98) (21.7) (24.6)
Household size0 4.974 -0.02 -0.01
(1.15) (21.5) (32.9)
T = 2 89 89 89 75 89 75
T = 3 135 135 135 126 135 126
T = 4 539 539 539 500 539 500
R2 0.002 0.150 0.208 0.200 0.222 0.209
Mean of dependent variable 0.88 0.88 0.88 0.88 0.88 0.88
N 1841 1976 1976 1976 1841 1976 1841

Notes:

  1. ANCOVA estimates using administrative and survey data. Post treatment regressands are regressed on categorical variables, pre-treatment regressand and other covariates. FloodInRd1 and HeadLiterate0 are indicator variables for the presence of self reported damage by a flood at the baseline, and literacy of household head, respectively. HHsize0 is household size at the baseline. We annotate the number of periods that a household is observed with T. The total number of households is shown for each values of T. T=4 indicates the number of households with complete panel information, T=3 indicates number of households observed three times, T=2 indicates the number of households observed twice. N indicates total number of observations used in ANCOVA estimation, or N$=$1$\ imes$(T=2)+2$\ imes$(T=3)+3$\ imes$(T=4). Large, LargeGrace, Cattle are indicator variables of the large, large grace, and cattle arms, respectively. The default arm category is traditional arm. Secondary and College are indicator variables of secondary schooling (ages 13-15) and tertiary schooling (ages 16-18), both at the time of baseline. Default category is primary (ages 05-12). Interaction terms of dummy variables are demeaned before interacting. The first column gives mean and standard deviation (in parenthesises) of each covariates before demeaning.
  2. \(P\) values in percentages in parenthesises. Standard errors are clustered at group (village) level.
Click here to see the table of time varying schooling impacts by arm.

Schooling, TimeVarying

covariates mean/std 1 2 3 4 5 6
(Intercept) 0.86 0.65 0.70 0.82 0.69 0.79
(0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Secondary 0.338 -0.14 -0.12 -0.14 -0.12
(0.47) (0.0) (0.0) (0.0) (0.0)
College 0.172 -0.24 -0.21 -0.23 -0.21
(0.38) (0.0) (0.0) (0.0) (0.0)
Large 0.272 -0.02 -0.03 -0.04 -0.03 -0.04 -0.03
(0.44) (59.3) (44.7) (23.7) (31.2) (23.9) (29.5)
LargeGrace 0.247 -0.03 -0.04 -0.04 -0.04 -0.03 -0.03
(0.43) (36.5) (26.6) (22.1) (19.0) (25.7) (22.7)
Cattle 0.257 -0.03 -0.04 -0.06 -0.05 -0.05 -0.05
(0.44) (39.5) (16.7) (5.3) (8.5) (6.3) (10.1)
Large \(\times\) Secondary 0.085 0.08 0.04 0.04 0.05 0.04 0.05
(0.28) (30.4) (61.0) (51.1) (41.6) (52.5) (40.9)
LargeGrace \(\times\) Secondary 0.083 -0.06 -0.06 -0.07 -0.07 -0.06 -0.07
(0.28) (47.8) (46.6) (30.1) (28.8) (36.9) (31.8)
Cattle \(\times\) Secondary 0.088 -0.01 0.00 -0.00 0.00 0.00 0.01
(0.28) (94.5) (99.9) (95.7) (97.4) (96.6) (91.3)
Large \(\times\) College 0.049 0.07 0.05 0.04 0.10 0.04 0.11
(0.22) (55.8) (68.1) (65.8) (27.9) (56.5) (20.1)
LargeGrace \(\times\) College 0.049 0.02 0.01 0.02 0.02 0.01 0.03
(0.22) (89.9) (91.9) (83.6) (77.4) (86.1) (72.3)
Cattle \(\times\) College 0.035 -0.04 -0.01 -0.06 -0.06 -0.05 -0.05
(0.18) (76.4) (90.8) (51.2) (48.7) (57.4) (59.2)
Female 0.450 0.04 0.05
(0.50) (6.1) (8.1)
Secondary \(\times\) Female 0.152 0.10 0.09
(0.36) (0.5) (1.0)
College \(\times\) Female 0.059 0.08 0.07
(0.24) (17.0) (27.8)
Large \(\times\) Female 0.121 -0.01 -0.01 -0.01 0.02 0.00 0.02
(0.33) (86.7) (82.8) (87.2) (76.8) (99.5) (64.3)
LargeGrace \(\times\) Female 0.114 0.10 0.09 0.09 0.07 0.09 0.07
(0.32) (11.7) (12.1) (11.2) (15.6) (8.1) (12.3)
Cattle \(\times\) Female 0.114 0.06 0.06 0.06 0.07 0.07 0.08
(0.32) (45.2) (28.3) (28.5) (15.8) (18.5) (10.0)
Large \(\times\) Secondary \(\times\) Female 0.041 -0.19 -0.17 -0.18 -0.22 -0.17 -0.21
(0.20) (14.3) (16.5) (12.0) (3.1) (11.0) (2.9)
LargeGrace \(\times\) Secondary \(\times\) Female 0.036 0.04 0.06 0.05 0.05 0.06 0.06
(0.19) (75.8) (60.9) (69.1) (61.8) (60.6) (51.4)
Cattle \(\times\) Secondary \(\times\) Female 0.037 0.01 -0.05 -0.07 -0.04 -0.05 -0.03
(0.19) (91.8) (72.1) (60.9) (76.1) (66.8) (81.6)
Large \(\times\) College \(\times\) Female 0.016 0.11 0.10 0.04 0.16 0.04 0.17
(0.12) (68.8) (63.9) (84.3) (45.5) (81.6) (42.8)
LargeGrace \(\times\) College \(\times\) Female 0.018 -0.06 -0.02 0.05 0.12 0.03 0.11
(0.13) (81.3) (94.6) (81.7) (55.9) (88.9) (58.7)
Cattle \(\times\) College \(\times\) Female 0.010 0.39 0.26 0.22 0.25 0.25 0.27
(0.10) (14.5) (24.3) (26.3) (21.9) (18.6) (18.8)
rd 3 0.343 0.05 0.04 0.06 0.05 0.06 0.05
(0.47) (0.0) (0.1) (0.0) (0.0) (0.0) (0.0)
Secondary \(\times\) rd 3 0.120 -0.01 -0.02 -0.01 -0.02
(0.32) (84.6) (46.7) (87.6) (47.3)
College \(\times\) rd 3 0.055 0.03 0.02 0.02 0.01
(0.23) (49.9) (68.7) (62.0) (79.1)
Large \(\times\) rd 3 0.091 -0.04 -0.04 -0.05 -0.05 -0.05 -0.06
(0.29) (29.4) (28.5) (17.0) (9.9) (17.3) (8.4)
LargeGrace \(\times\) rd 3 0.086 -0.07 -0.07 -0.08 -0.08 -0.08 -0.08
(0.28) (5.5) (3.2) (2.2) (2.6) (2.0) (2.2)
Cattle \(\times\) rd 3 0.089 -0.05 -0.06 -0.06 -0.07 -0.06 -0.06
(0.28) (22.0) (11.0) (11.1) (6.3) (11.2) (7.8)
Large \(\times\) Secondary \(\times\) rd 3 0.028 -0.04 0.00 0.00 -0.01 -0.01 -0.02
(0.17) (64.5) (96.8) (99.5) (89.1) (93.5) (81.4)
LargeGrace \(\times\) Secondary \(\times\) rd 3 0.028 0.05 0.08 0.08 0.06 0.06 0.05
(0.16) (56.2) (33.1) (33.0) (44.4) (43.8) (53.9)
Cattle \(\times\) Secondary \(\times\) rd 3 0.032 0.02 0.06 0.06 0.05 0.06 0.05
(0.18) (82.0) (49.7) (49.6) (58.1) (48.8) (57.7)
Large \(\times\) College \(\times\) rd 3 0.015 0.09 0.05 0.09 -0.01 0.09 -0.01
(0.12) (54.0) (66.2) (44.4) (94.6) (42.2) (93.4)
LargeGrace \(\times\) College \(\times\) rd 3 0.017 -0.04 -0.03 -0.01 -0.04 0.00 -0.04
(0.13) (66.6) (72.5) (89.9) (70.1) (99.4) (72.5)
Cattle \(\times\) College \(\times\) rd 3 0.012 0.05 0.03 0.04 -0.01 0.04 -0.01
(0.11) (74.2) (83.5) (76.8) (95.0) (76.2) (92.7)
Female \(\times\) rd 3 0.155 0.00 0.01
(0.36) (90.1) (69.1)
Large \(\times\) Female \(\times\) rd 3 0.040 0.07 0.06 0.07 0.06 0.07 0.07
(0.20) (29.9) (31.9) (23.3) (27.9) (19.2) (24.6)
LargeGrace \(\times\) Female \(\times\) rd 3 0.039 0.04 0.03 0.03 0.04 0.04 0.04
(0.19) (53.2) (55.6) (59.4) (51.8) (48.6) (43.0)
Cattle \(\times\) Female \(\times\) rd 3 0.040 0.03 0.05 0.05 0.05 0.06 0.06
(0.20) (64.0) (36.2) (37.5) (42.4) (37.6) (41.1)
Large \(\times\) Secondary \(\times\) Female \(\times\) rd 3 0.014 0.16 0.16 0.15 0.14 0.19 0.19
(0.12) (43.0) (36.8) (38.8) (30.7) (26.2) (17.3)
LargeGrace \(\times\) Secondary \(\times\) Female \(\times\) rd 3 0.012 0.23 0.19 0.21 0.22 0.24 0.26
(0.11) (25.8) (28.8) (23.3) (17.9) (14.9) (9.5)
Cattle \(\times\) Secondary \(\times\) Female \(\times\) rd 3 0.012 0.31 0.30 0.29 0.18 0.31 0.22
(0.11) (10.1) (7.8) (9.1) (22.6) (7.5) (14.4)
Large \(\times\) College \(\times\) Female \(\times\) rd 3 0.003 0.29 0.29 0.24 0.08 0.24 0.07
(0.06) (32.4) (20.5) (26.1) (76.4) (25.9) (78.1)
LargeGrace \(\times\) College \(\times\) Female \(\times\) rd 3 0.006 0.08 0.10 -0.05 -0.13 -0.04 -0.12
(0.08) (72.8) (61.7) (78.3) (54.8) (84.0) (58.5)
Cattle \(\times\) College \(\times\) Female \(\times\) rd 3 0.004 -0.43 -0.28 -0.29 -0.30 -0.29 -0.31
(0.06) (16.4) (27.8) (25.7) (28.5) (25.3) (28.4)
Secondary \(\times\) Female \(\times\) rd 3 0.052 -0.00 0.04
(0.22) (97.3) (46.1)
College \(\times\) Female \(\times\) rd 3 0.017 -0.01 -0.02
(0.13) (90.4) (85.6)
rd 4 0.276 0.10 0.08 0.14 0.13 0.14 0.13
(0.45) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Secondary \(\times\) rd 4 0.143 -0.02 -0.03 -0.02 -0.04
(0.35) (58.3) (43.3) (54.9) (40.7)
College \(\times\) rd 4 0.057 0.02 0.00 -0.00 -0.01
(0.23) (61.7) (94.4) (96.0) (84.5)
Large \(\times\) rd 4 0.080 -0.06 -0.04 -0.07 -0.08 -0.08 -0.09
(0.27) (27.2) (49.1) (10.9) (6.0) (8.5) (3.7)
LargeGrace \(\times\) rd 4 0.069 -0.02 -0.01 -0.04 -0.05 -0.04 -0.05
(0.25) (73.9) (84.2) (42.3) (26.3) (40.3) (25.3)
Cattle \(\times\) rd 4 0.067 -0.03 -0.03 -0.05 -0.05 -0.05 -0.05
(0.25) (50.0) (53.4) (27.7) (19.6) (26.3) (18.2)
Large \(\times\) Secondary \(\times\) rd 4 0.036 -0.11 -0.11 -0.04 -0.06 -0.03 -0.06
(0.19) (37.9) (32.6) (68.7) (52.8) (75.6) (53.2)
LargeGrace \(\times\) Secondary \(\times\) rd 4 0.035 0.04 0.02 0.06 0.05 0.04 0.03
(0.18) (75.2) (85.5) (55.4) (64.6) (69.0) (77.0)
Cattle \(\times\) Secondary \(\times\) rd 4 0.037 -0.02 -0.00 0.03 0.01 0.03 0.01
(0.19) (90.8) (97.2) (77.0) (90.8) (80.3) (93.2)
Large \(\times\) College \(\times\) rd 4 0.018 -0.10 -0.14 -0.03 -0.11 -0.02 -0.11
(0.13) (57.5) (34.5) (84.5) (44.0) (85.7) (43.0)
LargeGrace \(\times\) College \(\times\) rd 4 0.015 -0.29 -0.28 -0.23 -0.25 -0.20 -0.23
(0.12) (2.1) (1.7) (4.2) (2.9) (7.0) (3.9)
Cattle \(\times\) College \(\times\) rd 4 0.011 -0.15 -0.13 -0.08 -0.10 -0.05 -0.08
(0.10) (31.8) (29.1) (51.7) (43.4) (65.8) (54.2)
Female \(\times\) rd 4 0.131 -0.07 -0.06
(0.34) (0.5) (1.8)
Large \(\times\) Female \(\times\) rd 4 0.038 0.08 0.12 0.15 0.14 0.16 0.15
(0.19) (25.6) (12.1) (1.1) (3.3) (0.3) (1.3)
LargeGrace \(\times\) Female \(\times\) rd 4 0.034 -0.05 -0.00 -0.00 -0.00 0.00 0.00
(0.18) (51.7) (99.9) (95.7) (95.6) (94.9) (95.1)
Cattle \(\times\) Female \(\times\) rd 4 0.030 0.00 0.09 0.10 0.08 0.11 0.10
(0.17) (99.3) (28.7) (16.0) (19.9) (10.9) (13.2)
Large \(\times\) Secondary \(\times\) Female \(\times\) rd 4 0.016 0.22 0.11 0.05 0.11 0.02 0.07
(0.13) (33.7) (56.6) (80.5) (50.1) (90.6) (66.2)
LargeGrace \(\times\) Secondary \(\times\) Female \(\times\) rd 4 0.017 0.09 -0.09 -0.06 -0.02 -0.08 -0.03
(0.13) (70.0) (65.8) (73.5) (92.4) (67.0) (84.5)
Cattle \(\times\) Secondary \(\times\) Female \(\times\) rd 4 0.018 0.26 0.13 0.11 0.04 0.08 0.02
(0.13) (21.1) (48.6) (56.6) (82.3) (65.1) (91.3)
Large \(\times\) College \(\times\) Female \(\times\) rd 4 0.010 0.14 0.06 0.05 -0.20 -0.01 -0.25
(0.10) (66.7) (80.5) (83.9) (49.7) (96.2) (37.9)
LargeGrace \(\times\) College \(\times\) Female \(\times\) rd 4 0.007 0.37 0.27 0.08 -0.05 0.09 -0.05
(0.08) (18.0) (25.1) (72.7) (84.6) (71.6) (85.6)
Cattle \(\times\) College \(\times\) Female \(\times\) rd 4 0.004 0.03 -0.01 -0.14 -0.19 -0.12 -0.17
(0.06) (94.0) (98.5) (63.4) (54.4) (69.0) (60.6)
Secondary \(\times\) Female \(\times\) rd 4 0.067 -0.01 0.02
(0.25) (88.6) (78.2)
College \(\times\) Female \(\times\) rd 4 0.029 0.14 0.15
(0.17) (15.6) (17.0)
EldestSon 0.267 0.01 0.04
(0.44) (80.4) (23.2)
EldestDaughter 0.188 0.03 0.01
(0.39) (30.8) (77.7)
Flood in round 1 0.464 -0.05 -0.05
(0.50) (4.1) (3.2)
Head literate0 0.108 0.06 0.06
(0.31) (2.2) (2.3)
Head age0 39.153 -0.00 -0.00
(7.38) (17.9) (18.8)
Enrolled0 0.760 0.28 0.32 0.30 0.31 0.29
(0.43) (0.0) (0.0) (0.0) (0.0) (0.0)
ChildAgeOrderAtRd1 1.826 0.02 0.02
(0.98) (28.3) (25.9)
Household size0 4.974 -0.01 -0.01
(1.15) (34.3) (41.1)
T = 2 89 89 89 75 89 75
T = 3 135 135 135 126 135 126
T = 4 539 539 539 500 539 500
R2 0.021 0.160 0.232 0.216 0.240 0.222
Mean of dependent variable 0.88 0.88 0.88 0.88 0.88 0.88
N 1841 1976 1976 1976 1841 1976 1841

Schooling, TimeVarying

covariates mean/std 1 2 3 4 5 6
(Intercept) 0.86 0.65 0.70 0.82 0.69 0.79
(0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Secondary 0.338 -0.14 -0.12 -0.14 -0.12
(0.47) (0.0) (0.0) (0.0) (0.0)
College 0.172 -0.24 -0.21 -0.23 -0.21
(0.38) (0.0) (0.0) (0.0) (0.0)
Large 0.272 -0.02 -0.03 -0.04 -0.03 -0.04 -0.03
(0.44) (59.3) (44.7) (23.7) (31.2) (23.9) (29.5)
LargeGrace 0.247 -0.03 -0.04 -0.04 -0.04 -0.03 -0.03
(0.43) (36.5) (26.6) (22.1) (19.0) (25.7) (22.7)
Cattle 0.257 -0.03 -0.04 -0.06 -0.05 -0.05 -0.05
(0.44) (39.5) (16.7) (5.3) (8.5) (6.3) (10.1)
Large \(\times\) Secondary 0.085 0.08 0.04 0.04 0.05 0.04 0.05
(0.28) (30.4) (61.0) (51.1) (41.6) (52.5) (40.9)
LargeGrace \(\times\) Secondary 0.083 -0.06 -0.06 -0.07 -0.07 -0.06 -0.07
(0.28) (47.8) (46.6) (30.1) (28.8) (36.9) (31.8)
Cattle \(\times\) Secondary 0.088 -0.01 0.00 -0.00 0.00 0.00 0.01
(0.28) (94.5) (99.9) (95.7) (97.4) (96.6) (91.3)
Large \(\times\) College 0.049 0.07 0.05 0.04 0.10 0.04 0.11
(0.22) (55.8) (68.1) (65.8) (27.9) (56.5) (20.1)
LargeGrace \(\times\) College 0.049 0.02 0.01 0.02 0.02 0.01 0.03
(0.22) (89.9) (91.9) (83.6) (77.4) (86.1) (72.3)
Cattle \(\times\) College 0.035 -0.04 -0.01 -0.06 -0.06 -0.05 -0.05
(0.18) (76.4) (90.8) (51.2) (48.7) (57.4) (59.2)
Female 0.450 0.04 0.05
(0.50) (6.1) (8.1)
Secondary \(\times\) Female 0.152 0.10 0.09
(0.36) (0.5) (1.0)
College \(\times\) Female 0.059 0.08 0.07
(0.24) (17.0) (27.8)
Large \(\times\) Female 0.121 -0.01 -0.01 -0.01 0.02 0.00 0.02
(0.33) (86.7) (82.8) (87.2) (76.8) (99.5) (64.3)
LargeGrace \(\times\) Female 0.114 0.10 0.09 0.09 0.07 0.09 0.07
(0.32) (11.7) (12.1) (11.2) (15.6) (8.1) (12.3)
Cattle \(\times\) Female 0.114 0.06 0.06 0.06 0.07 0.07 0.08
(0.32) (45.2) (28.3) (28.5) (15.8) (18.5) (10.0)
Large \(\times\) Secondary \(\times\) Female 0.041 -0.19 -0.17 -0.18 -0.22 -0.17 -0.21
(0.20) (14.3) (16.5) (12.0) (3.1) (11.0) (2.9)
LargeGrace \(\times\) Secondary \(\times\) Female 0.036 0.04 0.06 0.05 0.05 0.06 0.06
(0.19) (75.8) (60.9) (69.1) (61.8) (60.6) (51.4)
Cattle \(\times\) Secondary \(\times\) Female 0.037 0.01 -0.05 -0.07 -0.04 -0.05 -0.03
(0.19) (91.8) (72.1) (60.9) (76.1) (66.8) (81.6)
Large \(\times\) College \(\times\) Female 0.016 0.11 0.10 0.04 0.16 0.04 0.17
(0.12) (68.8) (63.9) (84.3) (45.5) (81.6) (42.8)
LargeGrace \(\times\) College \(\times\) Female 0.018 -0.06 -0.02 0.05 0.12 0.03 0.11
(0.13) (81.3) (94.6) (81.7) (55.9) (88.9) (58.7)
Cattle \(\times\) College \(\times\) Female 0.010 0.39 0.26 0.22 0.25 0.25 0.27
(0.10) (14.5) (24.3) (26.3) (21.9) (18.6) (18.8)
rd 3 0.343 0.05 0.04 0.06 0.05 0.06 0.05
(0.47) (0.0) (0.1) (0.0) (0.0) (0.0) (0.0)
Secondary \(\times\) rd 3 0.120 -0.01 -0.02 -0.01 -0.02
(0.32) (84.6) (46.7) (87.6) (47.3)
College \(\times\) rd 3 0.055 0.03 0.02 0.02 0.01
(0.23) (49.9) (68.7) (62.0) (79.1)
Large \(\times\) rd 3 0.091 -0.04 -0.04 -0.05 -0.05 -0.05 -0.06
(0.29) (29.4) (28.5) (17.0) (9.9) (17.3) (8.4)
LargeGrace \(\times\) rd 3 0.086 -0.07 -0.07 -0.08 -0.08 -0.08 -0.08
(0.28) (5.5) (3.2) (2.2) (2.6) (2.0) (2.2)
Cattle \(\times\) rd 3 0.089 -0.05 -0.06 -0.06 -0.07 -0.06 -0.06
(0.28) (22.0) (11.0) (11.1) (6.3) (11.2) (7.8)
Large \(\times\) Secondary \(\times\) rd 3 0.028 -0.04 0.00 0.00 -0.01 -0.01 -0.02
(0.17) (64.5) (96.8) (99.5) (89.1) (93.5) (81.4)
LargeGrace \(\times\) Secondary \(\times\) rd 3 0.028 0.05 0.08 0.08 0.06 0.06 0.05
(0.16) (56.2) (33.1) (33.0) (44.4) (43.8) (53.9)
Cattle \(\times\) Secondary \(\times\) rd 3 0.032 0.02 0.06 0.06 0.05 0.06 0.05
(0.18) (82.0) (49.7) (49.6) (58.1) (48.8) (57.7)
Large \(\times\) College \(\times\) rd 3 0.015 0.09 0.05 0.09 -0.01 0.09 -0.01
(0.12) (54.0) (66.2) (44.4) (94.6) (42.2) (93.4)
LargeGrace \(\times\) College \(\times\) rd 3 0.017 -0.04 -0.03 -0.01 -0.04 0.00 -0.04
(0.13) (66.6) (72.5) (89.9) (70.1) (99.4) (72.5)
Cattle \(\times\) College \(\times\) rd 3 0.012 0.05 0.03 0.04 -0.01 0.04 -0.01
(0.11) (74.2) (83.5) (76.8) (95.0) (76.2) (92.7)
Female \(\times\) rd 3 0.155 0.00 0.01
(0.36) (90.1) (69.1)
Large \(\times\) Female \(\times\) rd 3 0.040 0.07 0.06 0.07 0.06 0.07 0.07
(0.20) (29.9) (31.9) (23.3) (27.9) (19.2) (24.6)
LargeGrace \(\times\) Female \(\times\) rd 3 0.039 0.04 0.03 0.03 0.04 0.04 0.04
(0.19) (53.2) (55.6) (59.4) (51.8) (48.6) (43.0)
Cattle \(\times\) Female \(\times\) rd 3 0.040 0.03 0.05 0.05 0.05 0.06 0.06
(0.20) (64.0) (36.2) (37.5) (42.4) (37.6) (41.1)
Large \(\times\) Secondary \(\times\) Female \(\times\) rd 3 0.014 0.16 0.16 0.15 0.14 0.19 0.19
(0.12) (43.0) (36.8) (38.8) (30.7) (26.2) (17.3)
LargeGrace \(\times\) Secondary \(\times\) Female \(\times\) rd 3 0.012 0.23 0.19 0.21 0.22 0.24 0.26
(0.11) (25.8) (28.8) (23.3) (17.9) (14.9) (9.5)
Cattle \(\times\) Secondary \(\times\) Female \(\times\) rd 3 0.012 0.31 0.30 0.29 0.18 0.31 0.22
(0.11) (10.1) (7.8) (9.1) (22.6) (7.5) (14.4)
Large \(\times\) College \(\times\) Female \(\times\) rd 3 0.003 0.29 0.29 0.24 0.08 0.24 0.07
(0.06) (32.4) (20.5) (26.1) (76.4) (25.9) (78.1)
LargeGrace \(\times\) College \(\times\) Female \(\times\) rd 3 0.006 0.08 0.10 -0.05 -0.13 -0.04 -0.12
(0.08) (72.8) (61.7) (78.3) (54.8) (84.0) (58.5)
Cattle \(\times\) College \(\times\) Female \(\times\) rd 3 0.004 -0.43 -0.28 -0.29 -0.30 -0.29 -0.31
(0.06) (16.4) (27.8) (25.7) (28.5) (25.3) (28.4)
Secondary \(\times\) Female \(\times\) rd 3 0.052 -0.00 0.04
(0.22) (97.3) (46.1)
College \(\times\) Female \(\times\) rd 3 0.017 -0.01 -0.02
(0.13) (90.4) (85.6)
rd 4 0.276 0.10 0.08 0.14 0.13 0.14 0.13
(0.45) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Secondary \(\times\) rd 4 0.143 -0.02 -0.03 -0.02 -0.04
(0.35) (58.3) (43.3) (54.9) (40.7)
College \(\times\) rd 4 0.057 0.02 0.00 -0.00 -0.01
(0.23) (61.7) (94.4) (96.0) (84.5)
Large \(\times\) rd 4 0.080 -0.06 -0.04 -0.07 -0.08 -0.08 -0.09
(0.27) (27.2) (49.1) (10.9) (6.0) (8.5) (3.7)
LargeGrace \(\times\) rd 4 0.069 -0.02 -0.01 -0.04 -0.05 -0.04 -0.05
(0.25) (73.9) (84.2) (42.3) (26.3) (40.3) (25.3)
Cattle \(\times\) rd 4 0.067 -0.03 -0.03 -0.05 -0.05 -0.05 -0.05
(0.25) (50.0) (53.4) (27.7) (19.6) (26.3) (18.2)
Large \(\times\) Secondary \(\times\) rd 4 0.036 -0.11 -0.11 -0.04 -0.06 -0.03 -0.06
(0.19) (37.9) (32.6) (68.7) (52.8) (75.6) (53.2)
LargeGrace \(\times\) Secondary \(\times\) rd 4 0.035 0.04 0.02 0.06 0.05 0.04 0.03
(0.18) (75.2) (85.5) (55.4) (64.6) (69.0) (77.0)
Cattle \(\times\) Secondary \(\times\) rd 4 0.037 -0.02 -0.00 0.03 0.01 0.03 0.01
(0.19) (90.8) (97.2) (77.0) (90.8) (80.3) (93.2)
Large \(\times\) College \(\times\) rd 4 0.018 -0.10 -0.14 -0.03 -0.11 -0.02 -0.11
(0.13) (57.5) (34.5) (84.5) (44.0) (85.7) (43.0)
LargeGrace \(\times\) College \(\times\) rd 4 0.015 -0.29 -0.28 -0.23 -0.25 -0.20 -0.23
(0.12) (2.1) (1.7) (4.2) (2.9) (7.0) (3.9)
Cattle \(\times\) College \(\times\) rd 4 0.011 -0.15 -0.13 -0.08 -0.10 -0.05 -0.08
(0.10) (31.8) (29.1) (51.7) (43.4) (65.8) (54.2)
Female \(\times\) rd 4 0.131 -0.07 -0.06
(0.34) (0.5) (1.8)
Large \(\times\) Female \(\times\) rd 4 0.038 0.08 0.12 0.15 0.14 0.16 0.15
(0.19) (25.6) (12.1) (1.1) (3.3) (0.3) (1.3)
LargeGrace \(\times\) Female \(\times\) rd 4 0.034 -0.05 -0.00 -0.00 -0.00 0.00 0.00
(0.18) (51.7) (99.9) (95.7) (95.6) (94.9) (95.1)
Cattle \(\times\) Female \(\times\) rd 4 0.030 0.00 0.09 0.10 0.08 0.11 0.10
(0.17) (99.3) (28.7) (16.0) (19.9) (10.9) (13.2)
Large \(\times\) Secondary \(\times\) Female \(\times\) rd 4 0.016 0.22 0.11 0.05 0.11 0.02 0.07
(0.13) (33.7) (56.6) (80.5) (50.1) (90.6) (66.2)
LargeGrace \(\times\) Secondary \(\times\) Female \(\times\) rd 4 0.017 0.09 -0.09 -0.06 -0.02 -0.08 -0.03
(0.13) (70.0) (65.8) (73.5) (92.4) (67.0) (84.5)
Cattle \(\times\) Secondary \(\times\) Female \(\times\) rd 4 0.018 0.26 0.13 0.11 0.04 0.08 0.02
(0.13) (21.1) (48.6) (56.6) (82.3) (65.1) (91.3)
Large \(\times\) College \(\times\) Female \(\times\) rd 4 0.010 0.14 0.06 0.05 -0.20 -0.01 -0.25
(0.10) (66.7) (80.5) (83.9) (49.7) (96.2) (37.9)
LargeGrace \(\times\) College \(\times\) Female \(\times\) rd 4 0.007 0.37 0.27 0.08 -0.05 0.09 -0.05
(0.08) (18.0) (25.1) (72.7) (84.6) (71.6) (85.6)
Cattle \(\times\) College \(\times\) Female \(\times\) rd 4 0.004 0.03 -0.01 -0.14 -0.19 -0.12 -0.17
(0.06) (94.0) (98.5) (63.4) (54.4) (69.0) (60.6)
Secondary \(\times\) Female \(\times\) rd 4 0.067 -0.01 0.02
(0.25) (88.6) (78.2)
College \(\times\) Female \(\times\) rd 4 0.029 0.14 0.15
(0.17) (15.6) (17.0)
EldestSon 0.267 0.01 0.04
(0.44) (80.4) (23.2)
EldestDaughter 0.188 0.03 0.01
(0.39) (30.8) (77.7)
Flood in round 1 0.464 -0.05 -0.05
(0.50) (4.1) (3.2)
Head literate0 0.108 0.06 0.06
(0.31) (2.2) (2.3)
Head age0 39.153 -0.00 -0.00
(7.38) (17.9) (18.8)
Enrolled0 0.760 0.28 0.32 0.30 0.31 0.29
(0.43) (0.0) (0.0) (0.0) (0.0) (0.0)
ChildAgeOrderAtRd1 1.826 0.02 0.02
(0.98) (28.3) (25.9)
Household size0 4.974 -0.01 -0.01
(1.15) (34.3) (41.1)
T = 2 89 89 89 75 89 75
T = 3 135 135 135 126 135 126
T = 4 539 539 539 500 539 500
R2 0.021 0.160 0.232 0.216 0.240 0.222
Mean of dependent variable 0.88 0.88 0.88 0.88 0.88 0.88
N 1841 1976 1976 1976 1841 1976 1841
Click here to see the table of time varying schooling impacts by functional attribute.

Schooling, TimeVaryingAttributes

covariates mean/std 1 2 3 4 5 6
(Intercept) 0.86 0.65 0.70 0.82 0.69 0.79
(0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Secondary 0.338 -0.14 -0.12 -0.14 -0.12
(0.47) (0.0) (0.0) (0.0) (0.0)
College 0.172 -0.24 -0.21 -0.23 -0.21
(0.38) (0.0) (0.0) (0.0) (0.0)
Upfront 0.776 -0.02 -0.03 -0.04 -0.03 -0.04 -0.03
(0.42) (59.3) (44.7) (23.7) (31.2) (23.9) (29.5)
WithGrace 0.504 -0.01 -0.01 0.00 -0.00 0.00 0.00
(0.50) (79.4) (76.0) (98.5) (90.5) (91.8) (99.8)
InKind 0.257 0.00 -0.01 -0.02 -0.01 -0.02 -0.01
(0.44) (98.6) (87.5) (57.9) (71.2) (58.3) (68.9)
WithGrace \(\times\) Secondary 0.171 -0.13 -0.10 -0.11 -0.13 -0.10 -0.12
(0.38) (6.8) (20.0) (6.3) (5.1) (10.2) (6.3)
Upfront \(\times\) Secondary 0.255 0.08 0.04 0.04 0.05 0.04 0.05
(0.44) (30.4) (61.0) (51.1) (41.6) (52.5) (40.9)
InKind \(\times\) Secondary 0.088 0.05 0.06 0.06 0.08 0.06 0.08
(0.28) (50.9) (44.1) (29.6) (25.1) (31.9) (25.6)
WithGrace \(\times\) College 0.084 -0.06 -0.03 -0.02 -0.07 -0.03 -0.08
(0.28) (60.4) (73.9) (79.4) (34.1) (65.6) (26.8)
Upfront \(\times\) College 0.134 0.07 0.05 0.04 0.10 0.04 0.11
(0.34) (55.8) (68.1) (65.8) (27.9) (56.5) (20.1)
InKind \(\times\) College 0.035 -0.06 -0.03 -0.08 -0.09 -0.06 -0.08
(0.18) (63.9) (81.6) (33.1) (26.4) (40.5) (30.5)
Female 0.450 0.04 0.05
(0.50) (6.1) (8.1)
Secondary \(\times\) Female 0.152 0.10 0.09
(0.36) (0.5) (1.0)
College \(\times\) Female 0.059 0.08 0.07
(0.24) (17.0) (27.8)
WithGrace \(\times\) Female 0.228 0.11 0.10 0.10 0.05 0.09 0.05
(0.42) (13.3) (16.0) (17.0) (43.7) (16.5) (45.6)
Upfront \(\times\) Female 0.349 -0.01 -0.01 -0.01 0.02 0.00 0.02
(0.48) (86.7) (82.8) (87.2) (76.8) (99.5) (64.3)
InKind \(\times\) Female 0.114 -0.05 -0.03 -0.03 0.00 -0.02 0.01
(0.32) (60.2) (71.4) (66.1) (97.2) (70.4) (92.1)
WithGrace \(\times\) Secondary \(\times\) Female 0.074 0.23 0.24 0.22 0.27 0.23 0.27
(0.26) (6.2) (2.2) (2.3) (0.2) (1.0) (0.1)
Upfront \(\times\) Secondary \(\times\) Female 0.115 -0.19 -0.17 -0.18 -0.22 -0.17 -0.21
(0.32) (14.3) (16.5) (12.0) (3.1) (11.0) (2.9)
InKind \(\times\) Secondary \(\times\) Female 0.037 -0.03 -0.11 -0.11 -0.09 -0.11 -0.09
(0.19) (83.3) (33.6) (33.9) (40.4) (30.0) (35.0)
WithGrace \(\times\) College \(\times\) Female 0.028 -0.17 -0.12 0.01 -0.04 -0.02 -0.05
(0.17) (44.3) (53.6) (96.1) (82.9) (91.7) (75.6)
Upfront \(\times\) College \(\times\) Female 0.044 0.11 0.10 0.04 0.16 0.04 0.17
(0.21) (68.8) (63.9) (84.3) (45.5) (81.6) (42.8)
InKind \(\times\) College \(\times\) Female 0.010 0.46 0.27 0.17 0.13 0.22 0.15
(0.10) (4.4) (16.1) (30.4) (44.0) (16.2) (35.2)
rd 3 0.343 0.05 0.04 0.06 0.05 0.06 0.05
(0.47) (0.0) (0.1) (0.0) (0.0) (0.0) (0.0)
Secondary \(\times\) rd 3 0.120 -0.01 -0.02 -0.01 -0.02
(0.32) (84.6) (46.7) (87.6) (47.3)
College \(\times\) rd 3 0.055 0.03 0.02 0.02 0.01
(0.23) (49.9) (68.7) (62.0) (79.1)
WithGrace \(\times\) rd 3 0.175 -0.03 -0.03 -0.04 -0.03 -0.04 -0.03
(0.38) (38.9) (30.8) (27.4) (43.3) (26.6) (42.1)
Upfront \(\times\) rd 3 0.266 -0.04 -0.04 -0.05 -0.05 -0.05 -0.06
(0.44) (29.4) (28.5) (17.0) (9.9) (17.3) (8.4)
InKind \(\times\) rd 3 0.089 0.02 0.01 0.02 0.02 0.03 0.02
(0.28) (62.6) (72.4) (51.6) (68.5) (46.1) (59.5)
WithGrace \(\times\) Secondary \(\times\) rd 3 0.060 0.10 0.08 0.08 0.07 0.07 0.07
(0.24) (31.9) (36.9) (36.1) (42.8) (42.6) (46.0)
Upfront \(\times\) Secondary \(\times\) rd 3 0.088 -0.04 0.00 0.00 -0.01 -0.01 -0.02
(0.28) (64.5) (96.8) (99.5) (89.1) (93.5) (81.4)
InKind \(\times\) Secondary \(\times\) rd 3 0.032 -0.03 -0.02 -0.02 -0.01 0.00 -0.00
(0.18) (76.9) (83.5) (85.9) (89.5) (99.7) (99.1)
WithGrace \(\times\) College \(\times\) rd 3 0.029 -0.13 -0.08 -0.10 -0.03 -0.09 -0.03
(0.17) (27.6) (39.8) (29.5) (76.9) (34.6) (81.3)
Upfront \(\times\) College \(\times\) rd 3 0.044 0.09 0.05 0.09 -0.01 0.09 -0.01
(0.21) (54.0) (66.2) (44.4) (94.6) (42.2) (93.4)
InKind \(\times\) College \(\times\) rd 3 0.012 0.09 0.06 0.05 0.03 0.04 0.02
(0.11) (47.3) (60.4) (67.0) (80.7) (73.8) (85.3)
Female \(\times\) rd 3 0.155 0.00 0.01
(0.36) (90.1) (69.1)
WithGrace \(\times\) Female \(\times\) rd 3 0.079 -0.03 -0.03 -0.03 -0.03 -0.03 -0.03
(0.27) (62.9) (66.0) (54.6) (62.8) (54.4) (64.3)
Upfront \(\times\) Female \(\times\) rd 3 0.119 0.07 0.06 0.07 0.06 0.07 0.07
(0.32) (29.9) (31.9) (23.3) (27.9) (19.2) (24.6)
InKind \(\times\) Female \(\times\) rd 3 0.040 -0.01 0.02 0.02 0.02 0.02 0.01
(0.20) (84.3) (73.6) (73.0) (80.4) (79.6) (85.2)
WithGrace \(\times\) Secondary \(\times\) Female \(\times\) rd 3 0.024 0.07 0.03 0.06 0.08 0.05 0.07
(0.15) (69.6) (85.8) (71.3) (63.8) (74.6) (65.0)
Upfront \(\times\) Secondary \(\times\) Female \(\times\) rd 3 0.038 0.16 0.16 0.15 0.14 0.19 0.19
(0.19) (43.0) (36.8) (38.8) (30.7) (26.2) (17.3)
InKind \(\times\) Secondary \(\times\) Female \(\times\) rd 3 0.012 0.08 0.11 0.09 -0.04 0.07 -0.05
(0.11) (65.7) (48.6) (60.1) (80.8) (68.9) (75.8)
WithGrace \(\times\) College \(\times\) Female \(\times\) rd 3 0.010 -0.21 -0.20 -0.29 -0.21 -0.27 -0.19
(0.10) (37.6) (34.1) (10.0) (31.1) (12.8) (38.6)
Upfront \(\times\) College \(\times\) Female \(\times\) rd 3 0.013 0.29 0.29 0.24 0.08 0.24 0.07
(0.11) (32.4) (20.5) (26.1) (76.4) (25.9) (78.1)
InKind \(\times\) College \(\times\) Female \(\times\) rd 3 0.004 -0.50 -0.38 -0.23 -0.18 -0.25 -0.19
(0.06) (5.1) (11.4) (28.9) (44.3) (26.5) (42.8)
Secondary \(\times\) Female \(\times\) rd 3 0.052 -0.00 0.04
(0.22) (97.3) (46.1)
College \(\times\) Female \(\times\) rd 3 0.017 -0.01 -0.02
(0.13) (90.4) (85.6)
rd 4 0.276 0.10 0.08 0.14 0.13 0.14 0.13
(0.45) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Secondary \(\times\) rd 4 0.143 -0.02 -0.03 -0.02 -0.04
(0.35) (58.3) (43.3) (54.9) (40.7)
College \(\times\) rd 4 0.057 0.02 0.00 -0.00 -0.01
(0.23) (61.7) (94.4) (96.0) (84.5)
WithGrace \(\times\) rd 4 0.136 0.04 0.03 0.04 0.03 0.04 0.04
(0.34) (36.8) (54.0) (34.8) (40.2) (32.9) (35.9)
Upfront \(\times\) rd 4 0.216 -0.06 -0.04 -0.07 -0.08 -0.08 -0.09
(0.41) (27.2) (49.1) (10.9) (6.0) (8.5) (3.7)
InKind \(\times\) rd 4 0.067 -0.02 -0.02 -0.01 -0.01 -0.01 -0.00
(0.25) (69.7) (60.2) (75.8) (89.8) (77.5) (91.9)
WithGrace \(\times\) Secondary \(\times\) rd 4 0.073 0.14 0.13 0.10 0.11 0.07 0.09
(0.26) (20.4) (18.9) (29.0) (28.9) (47.1) (38.9)
Upfront \(\times\) Secondary \(\times\) rd 4 0.109 -0.11 -0.11 -0.04 -0.06 -0.03 -0.06
(0.31) (37.9) (32.6) (68.7) (52.8) (75.6) (53.2)
InKind \(\times\) Secondary \(\times\) rd 4 0.037 -0.05 -0.03 -0.03 -0.04 -0.01 -0.02
(0.19) (67.3) (82.6) (79.7) (75.2) (90.1) (85.0)
WithGrace \(\times\) College \(\times\) rd 4 0.026 -0.20 -0.14 -0.20 -0.14 -0.18 -0.12
(0.16) (15.7) (24.2) (6.6) (23.2) (8.0) (27.5)
Upfront \(\times\) College \(\times\) rd 4 0.044 -0.10 -0.14 -0.03 -0.11 -0.02 -0.11
(0.21) (57.5) (34.5) (84.5) (44.0) (85.7) (43.0)
InKind \(\times\) College \(\times\) rd 4 0.011 0.14 0.14 0.15 0.15 0.15 0.16
(0.10) (23.1) (13.2) (14.4) (16.9) (9.8) (9.5)
Female \(\times\) rd 4 0.131 -0.07 -0.06
(0.34) (0.5) (1.8)
WithGrace \(\times\) Female \(\times\) rd 4 0.064 -0.14 -0.12 -0.15 -0.14 -0.16 -0.15
(0.24) (10.2) (13.3) (3.2) (3.9) (1.7) (2.9)
Upfront \(\times\) Female \(\times\) rd 4 0.102 0.08 0.12 0.15 0.14 0.16 0.15
(0.30) (25.6) (12.1) (1.1) (3.3) (0.3) (1.3)
InKind \(\times\) Female \(\times\) rd 4 0.030 0.06 0.09 0.10 0.09 0.10 0.09
(0.17) (51.5) (30.6) (20.4) (21.8) (17.3) (18.2)
WithGrace \(\times\) Secondary \(\times\) Female \(\times\) rd 4 0.035 -0.12 -0.20 -0.11 -0.13 -0.10 -0.10
(0.18) (57.9) (31.1) (55.8) (45.0) (58.3) (54.1)
Upfront \(\times\) Secondary \(\times\) Female \(\times\) rd 4 0.052 0.22 0.11 0.05 0.11 0.02 0.07
(0.22) (33.7) (56.6) (80.5) (50.1) (90.6) (66.2)
InKind \(\times\) Secondary \(\times\) Female \(\times\) rd 4 0.018 0.17 0.21 0.17 0.05 0.16 0.05
(0.13) (42.1) (25.3) (36.6) (75.5) (36.8) (76.7)
WithGrace \(\times\) College \(\times\) Female \(\times\) rd 4 0.010 0.23 0.21 0.04 0.14 0.10 0.21
(0.10) (34.6) (36.7) (88.1) (57.9) (66.1) (41.7)
Upfront \(\times\) College \(\times\) Female \(\times\) rd 4 0.021 0.14 0.06 0.05 -0.20 -0.01 -0.25
(0.14) (66.7) (80.5) (83.9) (49.7) (96.2) (37.9)
InKind \(\times\) College \(\times\) Female \(\times\) rd 4 0.004 -0.34 -0.28 -0.23 -0.14 -0.21 -0.12
(0.06) (30.4) (34.6) (44.0) (62.1) (47.9) (67.8)
Secondary \(\times\) Female \(\times\) rd 4 0.067 -0.01 0.02
(0.25) (88.6) (78.2)
College \(\times\) Female \(\times\) rd 4 0.029 0.14 0.15
(0.17) (15.6) (17.0)
EldestSon 0.267 0.01 0.04
(0.44) (80.4) (23.2)
EldestDaughter 0.188 0.03 0.01
(0.39) (30.8) (77.7)
Flood in round 1 0.464 -0.05 -0.05
(0.50) (4.1) (3.2)
Head literate0 0.108 0.06 0.06
(0.31) (2.2) (2.3)
Head age0 39.153 -0.00 -0.00
(7.38) (17.9) (18.8)
Enrolled0 0.760 0.28 0.32 0.30 0.31 0.29
(0.43) (0.0) (0.0) (0.0) (0.0) (0.0)
ChildAgeOrderAtRd1 1.826 0.02 0.02
(0.98) (28.3) (25.9)
Household size0 4.974 -0.01 -0.01
(1.15) (34.3) (41.1)
T = 2 89 89 89 75 89 75
T = 3 135 135 135 126 135 126
T = 4 539 539 539 500 539 500
R2 0.021 0.160 0.232 0.216 0.240 0.222
Mean of dependent variable 0.88 0.88 0.88 0.88 0.88 0.88
N 1841 1976 1976 1976 1841 1976 1841
Click here to see the table of schooling impacts by poverty class.

Schooling, PovertyStatus

covariates mean/std 1 2 3 4 5 6
(Intercept) 0.93 0.70 0.76 0.90 0.74 0.86
(0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Secondary 0.338 -0.11 -0.09 -0.11 -0.09
(0.47) (0.0) (0.0) (0.0) (0.0)
College 0.172 -0.21 -0.18 -0.19 -0.18
(0.38) (0.0) (0.0) (0.0) (0.0)
Upfront 0.776 -0.05 -0.04 -0.05 -0.05 -0.04 -0.05
(0.42) (17.7) (10.8) (8.2) (8.6) (10.5) (9.4)
WithGrace 0.504 -0.01 -0.01 -0.00 -0.00 -0.00 -0.00
(0.50) (81.7) (76.7) (98.7) (92.8) (91.9) (91.6)
InKind 0.257 -0.01 -0.01 -0.02 -0.02 -0.02 -0.01
(0.44) (81.2) (75.6) (47.5) (64.0) (54.6) (68.0)
UltraPoor 0.612 0.04 0.03 0.03 0.03 0.03 0.03
(0.49) (10.6) (22.0) (21.2) (22.9) (21.2) (20.4)
WithGrace \(\times\) Secondary 0.171 -0.07 -0.09 -0.06 -0.08
(0.38) (9.3) (5.4) (11.4) (5.9)
Upfront \(\times\) Secondary 0.255 -0.00 0.01 -0.00 0.01
(0.44) (99.2) (84.5) (97.5) (88.4)
InKind \(\times\) Secondary 0.088 0.06 0.07 0.06 0.08
(0.28) (14.5) (11.8) (13.2) (9.1)
WithGrace \(\times\) College 0.084 -0.05 -0.07 -0.05 -0.08
(0.28) (41.1) (26.0) (37.0) (18.0)
Upfront \(\times\) College 0.134 0.01 0.03 0.02 0.05
(0.34) (80.2) (68.4) (69.4) (46.2)
InKind \(\times\) College 0.035 -0.09 -0.10 -0.05 -0.06
(0.18) (23.0) (18.3) (40.2) (38.8)
Upfront \(\times\) UltraPoor 0.514 -0.04 -0.02 -0.01 0.00 -0.01 -0.00
(0.50) (69.1) (78.1) (91.1) (99.2) (89.1) (97.8)
WithGrace \(\times\) UltraPoor 0.350 -0.02 0.00 0.00 0.02 -0.01 0.01
(0.48) (79.2) (97.6) (96.9) (74.1) (94.1) (84.9)
InKind \(\times\) UltraPoor 0.186 0.01 0.03 0.01 -0.02 0.03 0.01
(0.39) (80.0) (58.3) (77.4) (72.4) (52.8) (85.2)
Secondary \(\times\) UltraPoor 0.215 -0.02 -0.04 -0.03 -0.03 -0.03 -0.03
(0.41) (59.5) (30.4) (36.1) (40.6) (32.4) (35.5)
College \(\times\) UltraPoor 0.103 0.09 0.04 0.04 0.05 0.06 0.05
(0.30) (19.8) (48.4) (40.1) (39.5) (25.6) (32.4)
Female 0.450 0.05 0.05
(0.50) (2.7) (4.9)
Secondary \(\times\) Female 0.152 0.08 0.08
(0.36) (0.6) (1.3)
College \(\times\) Female 0.059 0.12 0.11
(0.24) (1.3) (4.4)
Female \(\times\) UltraPoor 0.276 0.07 0.07
(0.45) (7.3) (7.2)
WithGrace \(\times\) Female 0.228 0.07 0.03
(0.42) (24.9) (61.9)
Upfront \(\times\) Female 0.349 -0.00 0.02
(0.48) (96.2) (74.8)
InKind \(\times\) Female 0.114 -0.02 0.01
(0.32) (76.0) (87.5)
WithGrace \(\times\) Secondary \(\times\) Female 0.074 0.19 0.23
(0.26) (0.6) (0.1)
Upfront \(\times\) Secondary \(\times\) Female 0.115 -0.10 -0.12
(0.32) (27.1) (17.4)
InKind \(\times\) Secondary \(\times\) Female 0.037 -0.04 -0.04
(0.19) (61.7) (57.6)
WithGrace \(\times\) College \(\times\) Female 0.028 -0.09 -0.08
(0.17) (46.5) (57.4)
Upfront \(\times\) College \(\times\) Female 0.044 0.06 0.09
(0.21) (63.9) (53.4)
InKind \(\times\) College \(\times\) Female 0.010 0.22 0.18
(0.10) (12.7) (26.6)
EldestSon 0.267 0.00 0.04
(0.44) (94.0) (31.0)
EldestDaughter 0.188 0.04 0.01
(0.39) (22.2) (70.9)
Flood in round 1 0.464 -0.04 -0.05
(0.50) (4.4) (2.5)
Head literate0 0.108 0.06 0.05
(0.31) (2.3) (2.9)
Head age0 39.153 -0.00 -0.00
(7.38) (10.6) (11.2)
Enrolled0 0.760 0.29 0.32 0.29 0.31 0.29
(0.43) (0.0) (0.0) (0.0) (0.0) (0.0)
ChildAgeOrderAtRd1 1.826 0.02 0.02
(0.98) (22.9) (27.4)
Household size0 4.974 -0.02 -0.01
(1.15) (19.7) (36.0)
T = 2 89 89 89 75 89 75
T = 3 135 135 135 126 135 126
T = 4 539 539 539 500 539 500
R2 0.008 0.151 0.209 0.201 0.225 0.212
Mean of dependent variable 0.88 0.88 0.88 0.88 0.88 0.88
N 1841 1976 1976 1976 1841 1976 1841

Repayment and net saving

In estimating impacts on repayment and saving, we use borrower only data AllMeetingsRepaymentInitialSample.rds (group meeting data) saved in the above.

By survey rounds, in repayment and saving file, there are 28, 561, 555, 554 observations of households in rounds 1, 2, 3, 4, respectively. This is smaller than the InitialSample size of 800 in the survey roster file because the survey includes rejecters and residents whose houses are washed away by flood, while repayment is defined only for the borrowers.

Saving started in rd 1. Repayment and saving are more frequent than survey rounds. In repayment and saving regressions, we aggregate the data at survey rounds. This is because we have no household survey information at the monthly frequency that we can attribute the causes of monthly repayment and saving fluctuations.

Read administrative meeting data attached with HH information AllMeetingsRepayment.rds (called arA in the below code).

arA <- readRDS(paste0(pathsaveHere, DataFileNames[2], "InitialSample.rds"))
if (Only800) arA <- arA[o800 == 1L & !grepl("tw|dou", TradGroup) & 
  !is.na(LoanYear), ]
#### EffectiveRepayment := value.repay + value.NetSaving
arA[, Arm := droplevels(Arm)]
arA[, HeadLiteracy := HeadLiteracy + 0]
setorder(arA, hhid, Date)
arA[, grepout("^Time$", colnames(arA)) := NULL]
table0(arA[LoanMonth == 1, .(LoanYear, Arm)])
table0(arA[, .(survey, Arm)])
#### 0 NAs in `CumRepaid`, so skip.
#### table0(arA[is.na(CumRepaid), .(tee, Arm)])

Tabulation of group meeting data at rd 1 (12th month):

addmargins(table0(arA[o800 == 1L & tee == 12, .(Mstatus, Arm)]))
              Arm
Mstatus        traditional large large grace cattle Sum
  gErosion               0     0           0      0   0
  gRejection             0     0           0      0   0
  iRejection             0     0           0      0   0
  iReplacement           0     0           0      0   0
  newGroup               0     0           0      0   0
  oldMember             85   171         167    153 576
  Sum                   85   171         167    153 576
Click here to see the code of repayment and saving regressions.
source(paste0(pathprogram, "ReadTrimRepaymentANCOVA.R"))
FileName <- "Repayment"
FileNameHeader <- c("", "PovertyStatus", "Attributes", 
  "TimeVarying", "TimeVaryingPovertyStatus", "TimeVaryingAttributes")
####  length(arsuffixes) = Number of est results tables to be produced
regsuffixes <- c("", "P", "a", "T", "TP", "Ta")
listheader <- paste0("sv", regsuffixes)
#### net saving (5), repayment (5), and a mean/std column for table
Regressands <-  c(rep(c("NetSaving", "Repaid"), each = 5), "Repaid")
Addseparatingcols = c(1, 6); Separatingcolwidth = rep(.1, 2)
Separatingcoltitle = c("", "Net saving", "Repayment"
#### We omit net saving + repayment as regressand because it is repetitive
#### , "\\mpage{3cm}{\\hfil Net saving \\\\\\hfil + repayment}"
)
#### If LY*arm, LY*attribute interactions are used, we have a singular matrix
source(paste0(pathprogram, "RepaymentCovariateSelectionANCOVA.R"))
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
#### jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
jay <- 11 # net saving (5), repayment (5), and a dummy column for table
#### arA: all individuals, arA2: only borrowers (but arA=arA2, so redundant)
DataToUse1 <- DataToUse2 <- rep(c("arA", "arA2"), each = jay)
dig.depmean <- 0
AddMeanStdColumn <- UseRawDataForDestat <- CreateHTMLTable <- T
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
Click here to see the table of time varying repayment impacts by arm.

Repayment, TimeVarying

covariates mean/std 1 2 3 4 5 6 7 8 9 10
(Intercept) 39.8 65.8 39.0 64.9 62.7 250.8 206.4 251.7 207.4 213.4
(0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Large 0.297 7.1 6.8 5.4 5.0 4.8 80.1 80.2 79.8 79.9 80.1
(0.46) (4.3) (5.8) (13.9) (17.7) (18.2) (0.0) (0.0) (0.0) (0.0) (0.0)
LargeGrace 0.291 20.8 20.5 17.8 17.4 18.0 81.5 81.7 80.6 80.7 78.3
(0.45) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Cattle 0.264 22.6 22.1 19.7 19.2 19.4 75.6 75.7 74.8 74.7 73.3
(0.44) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
LY3 0.258 -44.5 -44.5 -44.5 147.4 147.4 147.5
(0.44) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
LY4 0.233 -60.8 -60.8 -60.8 26.7 26.8 26.2
(0.42) (0.0) (0.0) (0.0) (27.6) (27.6) (28.8)
Flood in round 1 0.477 1.5 -11.7
(0.50) (65.8) (2.2)
Head literate0 0.122 1.9 10.2
(0.33) (44.3) (12.7)
Net saving0 355.719 0.0 0.0 0.0
(513.67) (3.6) (3.1) (4.2)
Household size0 4.241 0.3 -0.2
(1.38) (65.5) (89.8)
Repaid0 98.890 -0.0 -0.0 -0.0
(195.66) (83.6) (81.9) (83.4)
R2 0.008 0.079 0.009 0.081 0.081 0.005 0.031 0.005 0.031 0.032
Mean of dependent variable 54 54 54 54 54 318 318 318 318 318
N 26627 26758 26758 26758 26758 26627 26758 26758 26758 26758 26627
Note: Columns 1. - 5. show results for net saving, 6. - 10. show results for repayment.
Click here to see the table of time varying repayment impacts by arm and by poverty class.

Repayment, TimeVaryingPovertyStatus

covariates mean/std 1 2 3 4 5 6 7 8 9 10
(Intercept) 28.5 54.7 27.6 53.8 51.4 265.1 218.5 265.8 219.3 225.3
(0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Upfront 0.851 10.9 10.8 9.2 9.1 8.8 93.4 93.3 93.1 93.0 93.4
(0.36) (7.9) (1.6) (14.8) (5.1) (4.9) (0.0) (0.0) (0.0) (0.0) (0.0)
WithGrace 0.555 24.6 25.0 23.3 23.6 24.5 -33.1 -33.5 -33.5 -34.0 -36.7
(0.50) (0.3) (0.1) (0.3) (0.1) (0.0) (5.3) (3.8) (5.3) (3.7) (2.0)
InKind 0.264 -0.9 0.7 -0.7 1.0 0.5 -12.9 -15.7 -13.0 -15.7 -14.9
(0.44) (93.0) (93.7) (94.6) (91.1) (95.0) (45.3) (33.7) (45.3) (33.6) (35.0)
UltraPoor 0.714 3.5 2.7 3.5 2.7 2.8 -5.0 -3.8 -5.0 -3.7 -3.2
(0.45) (2.4) (5.9) (2.7) (6.5) (5.6) (14.7) (24.2) (15.0) (24.8) (34.2)
Upfront \(\times\) UltraPoor 0.609 -7.3 -6.9 -7.1 -6.8 -6.7 17.0 16.6 17.2 16.8 17.0
(0.49) (8.3) (8.4) (10.0) (10.1) (11.8) (15.9) (14.9) (16.0) (14.9) (17.5)
WithGrace \(\times\) UltraPoor 0.401 3.7 2.4 4.1 2.8 3.2 -9.0 -7.0 -9.0 -7.0 -8.0
(0.49) (31.2) (49.2) (28.7) (43.9) (37.5) (28.8) (37.6) (28.9) (37.7) (32.0)
InKind \(\times\) UltraPoor 0.191 6.2 6.6 5.2 5.6 5.3 -5.4 -5.7 -5.4 -5.7 -4.8
(0.39) (16.2) (9.1) (23.3) (14.2) (15.6) (58.0) (51.7) (58.0) (51.7) (58.2)
LY3 0.258 -45.9 -45.9 -45.9 154.4 154.4 154.7
(0.44) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Upfront \(\times\) LY3 0.220 -13.4 -14.1 -13.3 -14.0 -13.8 27.4 30.1 27.4 30.1 29.7
(0.41) (45.7) (3.6) (45.8) (3.6) (3.7) (65.1) (13.8) (65.1) (13.8) (14.5)
WithGrace \(\times\) LY3 0.143 -53.7 -54.9 -53.7 -54.9 -55.4 283.7 287.7 283.7 287.7 288.6
(0.35) (0.5) (0.0) (0.5) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
InKind \(\times\) LY3 0.069 8.0 1.3 8.0 1.2 1.5 -31.8 -9.2 -31.8 -9.2 -9.2
(0.25) (70.8) (92.9) (70.8) (93.0) (91.5) (60.5) (75.5) (60.5) (75.5) (75.6)
UltraPoor \(\times\) LY3 0.184 -5.1 -1.8 -5.1 -1.8 -1.8 16.3 5.2 16.3 5.2 4.8
(0.39) (9.8) (46.1) (9.7) (46.0) (46.8) (5.7) (45.0) (5.7) (45.0) (48.9)
Upfront \(\times\) UltraPoor \(\times\) LY3 0.157 8.8 7.9 8.8 7.9 8.2 -8.0 -5.0 -8.0 -5.0 -5.5
(0.36) (26.3) (30.5) (26.3) (30.5) (29.1) (72.8) (76.8) (72.8) (76.8) (74.6)
WithGrace \(\times\) UltraPoor \(\times\) LY3 0.104 -14.6 -9.5 -14.6 -9.5 -10.3 20.5 3.4 20.5 3.4 4.8
(0.30) (4.1) (12.3) (4.1) (12.3) (10.2) (33.1) (85.8) (33.1) (85.8) (80.0)
InKind \(\times\) UltraPoor \(\times\) LY3 0.050 -2.2 -2.9 -2.1 -2.9 -2.4 37.3 39.7 37.3 39.7 37.1
(0.22) (80.8) (62.3) (80.9) (62.5) (69.3) (14.8) (4.4) (14.8) (4.4) (6.3)
LY4 0.233 -62.1 -62.2 -62.2 30.1 30.2 29.6
(0.42) (0.0) (0.0) (0.0) (20.5) (20.5) (21.6)
Upfront \(\times\) LY4 0.198 -18.4 -20.4 -18.4 -20.4 -20.0 -128.5 -128.8 -128.5 -128.8 -129.7
(0.40) (44.6) (1.7) (44.6) (1.6) (1.7) (3.1) (2.7) (3.1) (2.7) (2.6)
WithGrace \(\times\) LY4 0.129 -48.7 -49.9 -48.7 -49.9 -50.6 66.6 67.6 66.5 67.5 67.0
(0.34) (4.6) (0.0) (4.7) (0.0) (0.0) (28.2) (26.8) (28.3) (26.9) (27.5)
InKind \(\times\) LY4 0.061 14.5 4.4 14.3 4.1 4.4 83.2 87.2 83.2 87.2 88.0
(0.24) (59.1) (78.0) (59.7) (79.1) (77.7) (21.8) (19.8) (21.8) (19.8) (19.5)
UltraPoor \(\times\) LY4 0.166 -5.3 -0.6 -5.3 -0.6 -0.5 -25.8 -27.8 -25.8 -27.8 -28.2
(0.37) (16.3) (82.6) (16.1) (81.7) (83.9) (7.6) (5.3) (7.6) (5.3) (5.0)
Upfront \(\times\) UltraPoor \(\times\) LY4 0.142 12.3 11.6 12.3 11.6 12.1 -32.7 -31.8 -32.7 -31.8 -32.7
(0.35) (17.7) (9.2) (17.6) (9.1) (8.8) (54.1) (55.7) (54.1) (55.7) (54.4)
WithGrace \(\times\) UltraPoor \(\times\) LY4 0.093 -11.9 -4.9 -12.0 -5.0 -5.9 13.1 9.8 13.1 9.8 9.1
(0.29) (18.8) (50.4) (18.4) (49.6) (43.3) (69.0) (76.2) (69.0) (76.3) (77.8)
InKind \(\times\) UltraPoor \(\times\) LY4 0.044 -15.0 -14.7 -14.8 -14.5 -13.9 8.9 10.2 8.9 10.2 12.7
(0.21) (17.7) (2.7) (18.0) (2.8) (3.5) (81.2) (78.4) (81.2) (78.4) (73.6)
Flood in round 1 0.477 1.4 -11.9
(0.50) (66.0) (2.0)
Head literate0 0.122 2.1 9.9
(0.33) (39.1) (15.0)
Net saving0 355.719 0.0 0.0 0.0
(513.67) (3.7) (3.1) (4.2)
Household size0 4.241 0.3 -0.2
(1.38) (61.7) (85.1)
Repaid0 98.890 -0.0 -0.0 -0.0
(195.66) (87.3) (85.1) (86.2)
R2 0.025 0.100 0.027 0.102 0.102 0.032 0.061 0.032 0.060 0.061
Mean of dependent variable 54 54 54 54 54 318 318 318 318 318
N 26627 26758 26758 26758 26758 26627 26758 26758 26758 26758 26627
Note: Columns 1. - 5. show results for net saving, 6. - 10. show results for repayment.

Effective repayment (repayment + net saving)

Arm no yes sum FullRepayRate
traditional 47 38 85 44.71
large 11 160 171 93.57
large grace 5 162 167 97.01
cattle 7 146 153 95.42
overall 70 506 576 87.85

Incomes

Income sources are mainly labour incomes (lab) and farm revenues (far) with 849 and 53 observations at baseline, respectively. We ignore farm incomes due to small number of observations.

FileName <- "FarmIncome"
FileNameHeader <- c("", "Attributes", "PovertyStatus", "TimeVarying", "TimeVaryingAttributes")
regsuffixes <- c("", "a", "P", "T", "Ta")
listheader <- paste0("fr", regsuffixes)
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
source(paste0(pathprogram, "FarmIncomeCovariateSelectionANCOVA2.R"))
jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
Regressands <- rep("TotalRevenue", 3)
DataToUse1 <- DataToUse2 <- rep("far", 3)
Addseparatingcols = NULL; Separatingcolwidth = NULL
Separatingcoltitle = NULL
dig.depmean <- 0
AddMeanStdColumn <- UseRawDataForDestat <- T
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
Click here to see the table of time varying labour income impacts by arm.

LabourIncome, TimeVarying

covariates mean/std 1 2 3 4 5 6
(Intercept) -8816.85 -7430.78 -62547.07 -62677.75 -62495.27 -62763.21
(11.6) (18.0) (0.0) (0.0) (0.0) (0.0)
Large 0.278 57.86 -423.32 -4123.79 -3650.26 -3671.96 -3644.75
(0.45) (99.4) (95.3) (52.0) (57.1) (56.8) (57.2)
LargeGrace 0.248 -1640.12 -6062.81 -5711.80 -5623.68 -5680.42 -5618.50
(0.43) (83.4) (39.3) (28.6) (27.4) (28.2) (27.5)
Cattle 0.254 -2639.37 -3736.48 -3779.51 -3437.02 -3936.97 -3470.55
(0.44) (72.4) (60.2) (52.0) (55.7) (50.8) (55.3)
HadCattle 0.182 -6243.86 -4304.91
(0.39) (4.3) (46.2)
rd 3 0.343 12756.19 12656.12 12527.04 12455.94 12511.17 12453.48
(0.47) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Large \(\times\) rd 3 0.094 -5829.95 -5631.78 -3203.30 -3356.01 -3365.26 -3349.47
(0.29) (35.6) (36.7) (57.7) (56.7) (55.8) (56.8)
LargeGrace \(\times\) rd 3 0.085 936.02 238.98 2477.92 2021.13 2397.09 2021.63
(0.28) (88.8) (97.1) (67.3) (72.8) (68.2) (72.8)
Cattle \(\times\) rd 3 0.086 -8803.54 -8036.22 -4730.16 -4955.94 -4659.65 -4955.97
(0.28) (27.0) (29.7) (49.8) (47.6) (50.2) (47.6)
rd 4 0.326 23425.62 23178.45 23358.08 23196.86 23281.62 23187.90
(0.47) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Large \(\times\) rd 4 0.095 10206.37 10316.22 12236.73 12423.59 12155.38 12455.76
(0.29) (43.8) (43.3) (34.5) (34.8) (34.6) (34.6)
LargeGrace \(\times\) rd 4 0.082 -32.79 -995.65 1417.26 944.34 1313.79 951.48
(0.27) (99.7) (89.4) (83.7) (88.9) (84.8) (88.8)
Cattle \(\times\) rd 4 0.081 -6838.00 -6698.93 -2219.15 -3239.63 -2454.82 -3267.38
(0.27) (49.5) (50.2) (81.2) (71.8) (79.3) (71.6)
HadCattle 0.182 -6243.86 -4304.91
(0.39) (4.3) (46.2)
HadCattle \(\times\) Large 0.062 7668.70 7737.34
(0.24) (36.6) (36.3)
HadCattle \(\times\) LargeGrace 0.041 2053.10 2088.17
(0.20) (80.2) (80.0)
HadCattle \(\times\) Cattle 0.042 15462.97 15316.35
(0.20) (11.1) (11.4)
HadCattle \(\times\) rd 3 0.063 -2822.82 -2835.09
(0.24) (51.5) (51.4)
HadCattle \(\times\) Large \(\times\) rd 3 0.020 -4048.82 -4027.17
(0.14) (80.4) (80.7)
HadCattle \(\times\) LargeGrace \(\times\) rd 3 0.014 -11496.21 -11499.33
(0.12) (50.3) (50.5)
HadCattle \(\times\) Cattle \(\times\) rd 3 0.016 -2998.49 -3021.18
(0.12) (85.9) (85.8)
HadCattle \(\times\) rd 4 0.058 -12206.87 -12251.58
(0.23) (5.0) (4.9)
HadCattle \(\times\) Large \(\times\) rd 4 0.021 -17854.54 -17704.72
(0.14) (35.9) (36.1)
HadCattle \(\times\) LargeGrace \(\times\) rd 4 0.013 -8432.04 -8411.57
(0.11) (51.9) (51.9)
HadCattle \(\times\) Cattle \(\times\) rd 4 0.012 -21790.20 -21969.19
(0.11) (20.4) (20.5)
Flood in round 1 0.488 6929.81 6851.29 6972.80 6875.29
(0.50) (15.4) (16.1) (15.3) (15.9)
Head literate0 0.113 -6779.24 -6184.79 -6024.13 -6167.96
(0.32) (21.3) (22.4) (26.2) (22.6)
TotalHHLabourIncome0 2397.862 0.11 0.09 0.09 0.09 0.09
(172385.37) (0.0) (0.0) (0.0) (0.0) (0.0)
Household size0 4.405 12181.57 12408.28 12439.85 12426.66
(1.53) (0.0) (0.0) (0.0) (0.0)
Number of cattle0 0.250 -5434.02 -1421.91
(0.60) (2.5) (71.4)
R2 0.013 0.065 0.119 0.119 0.121 0.118
Mean of dependent variable 2233 2233 2233 2233 2233 2233
N 2557 2566 2566 2557 2557 2557 2557

Consumption

Consumption is observed in rd 2-4. There are 1386 observations. As we lack the initial value, we use OLS using rd 2- 4 values to measure the impacts. It should be less precise but still gives consistent estimates.

6 regression specifications differ in terms of regressand and covariates. For regressands, we use per capita expenditure for (1) - (3), total expenditure for (4) - (6). (1), (4) are OLS with no covariates, (2), (5) are OLS with covariates. (3), (6) are dummy entries used only to compute mean and standard deviation.

source(paste0(pathprogram, "ReadTrimConsumptionANCOVA.R"))
# Page 6 of rd 4 questionnaire.
FileName <- "ConsumptionOLS"
regsuffixes <- c("", "a", "P", "T", "Ta", "TP", "TPa")
listheader <- paste0("co", regsuffixes)
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
source(paste0(pathprogram, "ConsumptionCovariateSelectionOLS.R"))
#### jay: number of reg specs. This defines table dimension.
jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
Regressands <- c(rep("PCExpenditure", 3), rep("TotalExpenditure", 3),
  "PCExpenditure")
DataToUse1 <- DataToUse2 <- rep("conOLS", 7)
Addseparatingcols = c(1, 4); Separatingcolwidth = rep(.2, 2)
Separatingcoltitle = c("", "Per capita consumption (Tk)", 
  "Total consumption (Tk)")
dig.depmean <- 0
AddMeanStdColumn <- T
UseRawDataForDestat <- F
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
Click here to see the table of OLS time varying consumption impacts by arm.

ConsumptionOLS, TimeVarying

covariates mean/std 1 2 3 4
(Intercept) 2202.0 3179.3 8984.1 2955.7
(0.0) (0.0) (0.0) (0.0)
Large 0.283 -24.8 30.0 293.2 -28.5
(0.45) (70.7) (63.3) (43.8) (90.9)
LargeGrace 0.255 -9.2 21.2 350.0 147.7
(0.44) (87.7) (75.6) (43.3) (59.4)
Cattle 0.265 -36.6 -5.6 105.4 -108.1
(0.44) (54.8) (92.3) (76.1) (62.1)
rd 3 0.340 558.1 552.3 2077.7 2071.6
(0.47) (0.0) (0.0) (0.0) (0.0)
Large \(\times\) rd 3 -0.001 131.6 122.9 389.1 431.3
(0.21) (22.6) (25.6) (35.3) (30.2)
LargeGrace \(\times\) rd 3 -0.001 -80.0 -81.7 -367.4 -360.1
(0.21) (42.4) (41.3) (33.3) (34.3)
Cattle \(\times\) rd 3 0.000 170.7 142.7 740.4 774.6
(0.21) (8.1) (14.5) (7.6) (6.1)
rd 4 0.322 660.0 659.0 2075.6 2080.1
(0.47) (0.0) (0.0) (0.0) (0.0)
Large \(\times\) rd 4 0.003 124.3 104.1 1.6 134.6
(0.21) (18.2) (24.2) (99.6) (67.6)
LargeGrace \(\times\) rd 4 0.003 -18.3 -33.6 -432.2 -330.3
(0.20) (84.1) (70.1) (21.0) (33.4)
Cattle \(\times\) rd 4 -0.001 12.7 -22.7 -220.7 -31.9
(0.21) (87.4) (76.6) (47.7) (91.7)
Flood in round 1 0.480 -43.5 23.1
(0.50) (18.9) (86.8)
Head literate0 0.119 -9.2 146.8
(0.32) (76.4) (33.0)
Household size0 4.403 -223.9 1408.7
(1.50) (0.0) (0.0)
TotalExpenditure0 9221.300
(3107.21)
T = 2 28 28 28 28
T = 3 96 96 96 96
T = 4 1277 1274 1277 1274
R2 0.137 0.324 0.086 0.470
Mean of dependent variable 2586 2586 10558 10558
N 77 4051 4042 4051 4042

Net assets: Assets+Livestock-GUK Debt-Other Debts

Net assets = Assets + net saving - debt to GUK - debts to relatives and money lenders. Assets use only items observed for all 4 rounds for household assets including radios and cassette players (which may have large measurement errors).

source(paste0(pathprogram, "ComputeNetAssetsANCOVA.R"))
Click here to see the code of net asset regressions.
FileName <- "NetAssets"
FileNameHeader <- c("", "PovertyStatus", "Attributes",
    "TimeVarying", "TimeVaryingAttributes",
  "TimeVaryingPovertyStatus", "TimeVaryingPovertyStatusAttributes")
regsuffixes <- c("", "P", "a", "T", "Ta", "TP", "TPa")
listheader <- paste0("nea", regsuffixes)
library(qs)
source(paste0(pathprogram, "NetAssetCovariateSelectionANCOVA2.R"))
####  number of regressions per specification k=1, ..., length(regsuffixes)
NeA1 <- readRDS(paste0(pathsaveHere, "NetAssetsRegData.rds"))
if (Only800) NeA1 <- NeA1[o800 == 1L, ]
NeA1[, grepout("Net2|Na|Br|^R|Pro|PAss", colnames(NeA1)) := NULL]
####  ls(pattern = "^incl\\d"): created in NetAssetCovariateSelectionANCOVA2.R 
####  "incl1" "incl2" "incl3" "incl4" "incl5" "incl6"
####  So jay = 6, 6 reg specifications in estimation. 1 is OLS, 2-6 are ANCOVA.
####   incl1: ^dummy[CI].*[ed]$|^dummy[LW].*[cgz]e$|dummy.*Poor$
####   incla1: ^dummy[CI].*[ed]$|^dummy[LW].*[cgz]e$|dummy.*Poor$
####   inclP1: ^dummy[CI].*[ed]$|^dummy[LW].*[cgz]e$|dummy.*Poor$
####   inclT1: ^(?=dummy[CI].*[ed].*|^dummy[LW].*[cgz]e.*|^Time\\.)(?!.*Had)
####   inclTa1: ^(?=dummy[CI].*[ed].*|^dummy[LW].*[cgz]e.*|^Time\\.)(?!.*Had)
####   inclTPa1: ^(?=dummy[CI].*[ed]|^dummy[LW].*[cgz]e.*|^Time\\.|^d.*Poor)(?!.*Had)
####  Data=NeA1. It is created in MergeAllNetAssetsANCOVA.R
####  Below is the snippets of it.
####      ass <- readRDS(paste0(pathsaveHere, DataFileNames[4], "Trimmed.rds"))
####      obr <- readRDS(paste0(pathsaveHere, DataFileNames[11], "Trimmed.rds"))
####      arA <- readRDS(paste0(pathsaveHere, DataFileNames[2], "Trimmed.rds"))
####      lvo <- readRDS(paste0(pathsaveHere, DataFileNames[5], "InitialSample.rds"))
####      asso <- obr[ass]
####      assD <- asso[!is.na(IntDate), .(Arm, BStatus, hhid, survey, IntDate)]
####      arD <- arA[, .(hhid, survey, tee, Date, AttritIn, CumLoanAmount, 
####      arDebt <- assDW[arD]
####      assoD <- arDebtW[asso]
####      ass1R <- assoD[, 
####          grepout(paste0(assstrings, "|RM"), colnames(assoD)), with = F]
####      NeA1R <- merge(ass1R, lvo1, by = commoncols, all.x = T)
####      NeA1 <- NeA1R[tee > 1, ]
jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
DataToUse1 <- DataToUse2 <- rep("NeA1", jay)
####  Previously, Rd 1-4 diff: DataToUse2 <- rep("NeA2", jay)
Addseparatingcols <- NULL; Separatingcolwidth <- NULL
Separatingcoltitle <- NULL
Regressands <- rep("NetValue", jay)
tableboxwidth <- 4.5
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
dig.depmean <- 0
AddMeanStdColumn <- UseRawDataForDestat <- T
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
ktft <- TabVariableDescription
Click here to see the code of plotting net assets.
library(ggplot2)
####  NetAssetsFigureData.rds created in ComputeNetAssetsANCOVA.rnw
NeAfig <- readRDS(paste0(pathsaveHere, "NetAssetsFigureData.rds"))
if (Only800) NeAfig <- NeAfig[o800 == 1L, ]
d2 <- subset(NeAfig, !is.na(Arm))
ColourForPoints <- c("darkblue", "darkred")
g <- ggplot(data = subset(d2, tee == 2 & 0 <= NetValue & NetValue < 100000), 
  aes(x=NarrowNetValue, fill = povertystatus)) + 
  geom_histogram(bins=50, alpha=.5, position="identity",
    aes(x = NetValue, y = ..density..)) +
  scale_x_log10() +
  theme(
    axis.text.x = element_text(size = 6), 
    axis.text.y = element_text(size = 6), 
    axis.title = element_text(size = 7), 
    legend.key.size = unit(.15, "cm"),
    legend.text = element_text(size = 6),
    legend.title = element_text(size = 6),
    legend.position = "bottom")
ggsave(
  paste0(pathprogram, "figure/EstimationMemo/NetAssetsAtRd1.png"),
  g,
  width = 12, height = 6, units = "cm",
  dpi = 300
 )
####  postscript does not support transparency.
####  setEPS()
####  postscript(file =  
####    paste0(pathprogram, 
####      "figure/ImpactEstimationOriginal1600Memo3/NetAssetsAtRd1.eps"),
####    , width = 5, height = 2.5, horizontal = F) # unit: inch
####  print(g)
####  dev.off()
pdf(file =  
  paste0(pathprogram, "figure/EstimationMemo/NetAssetsAtRd1.pdf"),
  , width = 8/2.54, height = 5/2.54, pointsize = 10) # native unit: inch
print(g)
whatever <- dev.off()
library(ggplot2)
####  NetAssetsFigureData.rds created in ComputeNetAssetsANCOVA.rnw
NeAfig <- readRDS(paste0(pathsaveHere, "NetAssetsFigureData.rds"))
if (Only800) NeAfig <- NeAfig[o800 == 1L, ]
d2 <- subset(NeAfig, !is.na(Arm))
d2[, Type := "net assets"]
g <- ggplot(data = d2) + 
  geom_boxplot(aes(x= factor(tee), y = NetValue, colour = povertystatus), 
    outlier.alpha = 0.1)+
  scale_x_discrete(name = "survey round") +
  scale_y_continuous(name = "asset values (Tk.)",
    breaks = seq(0, 100000, 10000), limits = c(0, 100000)) +
  theme(
   axis.text.x = element_text(size = 6), 
   axis.text.y = element_text(size = 6), 
   axis.title = element_text(size = 7), 
   strip.text.x = element_text(color = "blue", size = 6, 
     margin = margin(0, .5, 0, .5, "cm")), 
   strip.text.y = element_text(color = "blue", size = 6, 
     margin = margin(.5, 0, .5, 0, "cm")),
   legend.position = "bottom") +
  facet_grid(. ~ Arm)
ggsave(
  paste0(pathprogram, 
    "figure/EstimationMemo/NetAssets.jpg"),
  g,
  width = 12, height = 6, units = "cm",
  dpi = 300*4
 )
pdf(file =  
  paste0(pathprogram, 
    "figure/EstimationMemo/NetAssets.pdf"),
  , width = 8/2.54, height = 5/2.54, pointsize = 10) # native unit: inch
print(g)
whatever <- dev.off()
Click here to see the table of time varying net asset impacts by arm. Net assets impacts by arm and period

NetAssets, TimeVarying

covariates mean/std 1 2 3 4 5 6
(Intercept) 12646.9 10282.5 2299.9 8022.1 3297.9 6994.4
(0.0) (0.0) (58.9) (9.8) (47.0) (15.5)
Large 0.048 10890.6 10623.8 10381.9 6523.4 10458.4 6586.4
(0.46) (0.1) (0.6) (1.0) (8.6) (1.4) (8.6)
LargeGrace 0.006 3096.2 1570.8 1737.2 -142.5 1685.6 -291.9
(0.43) (25.7) (64.3) (60.1) (96.4) (62.1) (92.7)
Cattle 0.009 2868.1 2107.0 2201.4 135.8 2761.9 215.5
(0.44) (12.1) (45.3) (43.5) (96.2) (32.7) (93.9)
HadCattle 0.265 7844.7 10322.0
(0.44) (20.3) (11.8)
rd 3 0.342 5516.3 5585.3 5867.5 8494.7 7501.6 8592.1
(0.47) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Large \(\times\) rd 3 0.104 1007.0 2841.9 3332.8 2191.4 3249.5 2519.2
(0.30) (77.4) (51.1) (45.0) (65.3) (45.3) (60.6)
LargeGrace \(\times\) rd 3 0.085 7093.3 9543.1 9847.3 10981.5 9269.2 10942.2
(0.28) (2.6) (2.5) (2.0) (1.8) (3.3) (1.9)
Cattle \(\times\) rd 3 0.087 3318.1 4812.6 4884.2 5346.2 5803.4 5332.1
(0.28) (26.3) (17.6) (16.5) (16.3) (7.2) (16.5)
rd 4 0.315 10249.0 10180.6 10359.3 14091.2 12042.9 14153.5
(0.46) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Large \(\times\) rd 4 0.102 3806.0 5738.0 5501.7 4129.9 5601.6 4453.6
(0.30) (40.0) (21.0) (23.1) (37.8) (21.5) (34.2)
LargeGrace \(\times\) rd 4 0.080 9491.2 12706.0 12955.7 15469.4 12581.3 15375.2
(0.27) (0.4) (0.2) (0.2) (0.1) (0.3) (0.1)
Cattle \(\times\) rd 4 0.079 7611.9 9021.9 9239.7 9955.1 10302.6 9753.9
(0.27) (2.1) (1.3) (1.0) (0.8) (0.2) (0.9)
HadCattle 0.265 7844.7 10322.0
(0.44) (20.3) (11.8)
HadCattle \(\times\) Large 0.024 17624.6 17922.7
(0.25) (11.2) (10.5)
HadCattle \(\times\) LargeGrace 0.009 7123.7 7883.5
(0.23) (32.2) (26.1)
HadCattle \(\times\) Cattle -0.012 11774.6 11719.1
(0.21) (8.6) (7.9)
HadCattle \(\times\) rd 3 0.092 -4533.7 -4613.9
(0.29) (11.0) (10.2)
HadCattle \(\times\) Large \(\times\) rd 3 0.008 3450.3 3020.9
(0.15) (69.2) (72.8)
HadCattle \(\times\) LargeGrace \(\times\) rd 3 0.003 -24243.5 -24292.4
(0.14) (1.1) (1.1)
HadCattle \(\times\) Cattle \(\times\) rd 3 -0.004 -3368.5 -3444.3
(0.12) (65.9) (65.1)
HadCattle \(\times\) rd 4 0.084 -2318.8 -2443.7
(0.28) (54.3) (52.1)
HadCattle \(\times\) Large \(\times\) rd 4 0.009 818.9 665.8
(0.14) (94.2) (95.2)
HadCattle \(\times\) LargeGrace \(\times\) rd 4 0.004 -29993.9 -29696.8
(0.13) (1.7) (1.8)
HadCattle \(\times\) Cattle \(\times\) rd 4 -0.005 -7135.7 -6917.8
(0.11) (45.5) (46.7)
Flood in round 1 0.414 91.1 1956.7 377.2 2134.2
(0.49) (96.7) (41.3) (87.7) (39.4)
Head literate0 0.149 -746.3 -1625.8 -2035.7 -1618.0
(0.36) (78.5) (58.6) (47.3) (59.1)
NetValue0 10261.899 0.5 0.5 0.2 0.6 0.7
(15197.09) (0.0) (0.0) (38.7) (5.5) (4.7)
Household size0 4.538 1797.5 1341.8 1633.0 1273.0
(1.35) (3.1) (15.2) (6.6) (17.1)
Number of cattle0 0.380 -2867.9 -12092.9
(0.73) (66.8) (15.4)
T = 2 42 13 13 13 10 13
T = 3 133 82 79 38 40 36
T = 4 550 362 362 327 362 327
R2 0.057 0.132 0.139 0.138 0.127 0.141
Mean of dependent variable 22717 22717 22717 22717 22717 22717
N 1081 1958 1263 1257 1070 1176 1066

Note: Head literate is an indicator variable of household head literacy. Head age is age of household head. Household size is total number of household members. Flood at baseline is an indicator variable of flood exposure. Household asset amount and Productive asset amount are amount of non-livestock household and productive assets, respectively, in BDT. Livestock value is BDT value of all livestock holding beyond cattle. Number of cattle holding is number of cattle holding. Net asset value is net asset values in BDT using asset items observed in all 4 rounds. Broad net asset value is net asset values in BDT for all asset items. Attrited indicates attrition rates in the household survey, and GRejected and IRejected show group rejection rates and individual rejection rates to the lending program. Non-attriting borrowers indicates the ratio of non-attriting borrowers to all borrowers. Because attrition and rejection are separate events, a household can reject and attrit, so non-attrited borrowers \(\geqslant\) total - (rejected members + attrited members). USD 1 is about BDT 80.

Net non-livestock assets: Non-livestock assets-GUK Debt-Other Debts

Net non-livestock assets = Non livestock assets + net saving - debt to GUK - debts to relatives and money lenders.

Click here to see the code and results table of net non-livestock assets.
FileName <- "NetNLAssets"
FileNameHeader <- c("", "PovertyStatus", "Attributes",
    "TimeVarying", "TimeVaryingAttributes",
  "TimeVaryingPovertyStatus", "TimeVaryingPovertyStatusAttributes")
regsuffixes <- c("", "P", "a", "T", "Ta", "TP", "TPa")
listheader <- paste0("nl", regsuffixes)
source(paste0(pathprogram, "NetNLAssetCovariateSelectionANCOVA2.R"))
NeA1 <- readRDS(paste0(pathsaveHere, "NetAssetsRegData.rds"))
NeA1[, grepout("Net2?Va|Out|Adi|Own", colnames(NeA1)) := NULL]
jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
DataToUse1 <- DataToUse2 <- rep("NeA1", jay)
Addseparatingcols <- NULL; Separatingcolwidth <- NULL
Separatingcoltitle <- NULL
Regressands <- rep("NetNLAssetValue", jay)
tableboxwidth <- 4.5
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
if (Only800) NeA1 <- NeA1[o800 == 1L, ]
dig.depmean <- 0
AddMeanStdColumn <- UseRawDataForDestat <- T
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))

NetNLAssets, TimeVarying

covariates mean/std 1 2 3 4 5 6
(Intercept) -3523.5 -3661.1 -3578.0 -3908.8 -3447.2 -3966.9
(0.0) (0.1) (0.1) (0.0) (0.1) (0.0)
Large 0.048 227.7 906.4 1162.6 1240.8 1256.7 1240.6
(0.46) (85.2) (54.2) (42.8) (40.9) (39.1) (41.2)
LargeGrace 0.006 -2232.2 -2125.7 -2217.7 -2624.6 -2247.0 -2629.4
(0.43) (6.5) (22.2) (18.4) (11.1) (17.6) (11.1)
Cattle 0.009 -1841.4 -1460.1 -1329.8 -1643.8 -1520.5 -1681.7
(0.44) (4.1) (19.7) (23.5) (14.2) (17.0) (13.8)
HadCattle 0.265 -665.3 268.3
(0.44) (55.3) (89.2)
rd 3 0.342 4562.1 4985.7 4996.5 5370.0 5072.1 5388.3
(0.47) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Large \(\times\) rd 3 0.104 3281.8 2238.6 2235.5 1787.9 2233.7 1852.4
(0.30) (0.5) (19.9) (20.2) (37.3) (20.5) (35.8)
LargeGrace \(\times\) rd 3 0.085 7802.8 7792.1 7785.8 8343.5 7659.7 8341.9
(0.28) (0.0) (0.1) (0.1) (0.1) (0.1) (0.1)
Cattle \(\times\) rd 3 0.087 5329.4 4223.4 4245.3 3988.8 3963.6 3986.5
(0.28) (0.0) (1.2) (1.2) (4.1) (2.1) (4.1)
rd 4 0.315 7527.5 7723.5 7734.6 7895.3 7645.7 7904.8
(0.46) (0.0) (0.0) (0.0) (0.0) (0.0) (0.0)
Large \(\times\) rd 4 0.102 3825.9 3044.2 2943.9 2865.1 3055.2 2905.4
(0.30) (1.1) (11.8) (13.3) (13.3) (11.9) (12.9)
LargeGrace \(\times\) rd 4 0.080 8200.2 8302.3 8174.3 9231.2 8094.4 9236.4
(0.27) (0.0) (0.1) (0.1) (0.0) (0.2) (0.0)
Cattle \(\times\) rd 4 0.079 7534.9 6436.0 6419.1 6444.4 5890.8 6441.1
(0.27) (0.0) (0.1) (0.1) (0.1) (0.2) (0.1)
HadCattle 0.265 -665.3 268.3
(0.44) (55.3) (89.2)
HadCattle \(\times\) Large 0.024 2386.6 2262.8
(0.25) (49.1) (51.5)
HadCattle \(\times\) LargeGrace 0.009 6685.1 6663.2
(0.23) (8.9) (8.8)
HadCattle \(\times\) Cattle -0.012 5578.7 5428.7
(0.21) (5.9) (7.3)
HadCattle \(\times\) rd 3 0.092 58.9 51.4
(0.29) (97.3) (97.6)
HadCattle \(\times\) Large \(\times\) rd 3 0.008 -1111.6 -1171.7
(0.15) (85.6) (84.9)
HadCattle \(\times\) LargeGrace \(\times\) rd 3 0.003 -8868.6 -8883.2
(0.14) (18.0) (17.8)
HadCattle \(\times\) Cattle \(\times\) rd 3 -0.004 -3749.8 -3765.7
(0.12) (53.4) (53.2)
HadCattle \(\times\) rd 4 0.084 1180.3 1175.7
(0.28) (56.1) (56.3)
HadCattle \(\times\) Large \(\times\) rd 4 0.009 -2954.3 -2958.0
(0.14) (64.3) (64.4)
HadCattle \(\times\) LargeGrace \(\times\) rd 4 0.004 -11657.5 -11648.0
(0.13) (12.0) (12.2)
HadCattle \(\times\) Cattle \(\times\) rd 4 -0.005 -4660.8 -4704.6
(0.11) (46.7) (46.2)
Flood in round 1 0.414 -1538.6 -1532.3 -1732.7 -1522.9
(0.49) (3.8) (6.6) (2.7) (7.1)
Head literate0 0.149 145.2 -8.8 210.2 0.1
(0.36) (80.8) (99.0) (72.5) (100.0)
NetAssetValue0 2657.829 0.1 0.1 0.2 0.2 0.2
(2852.68) (1.3) (1.1) (6.1) (9.6) (6.9)
Household size0 4.538 96.4 169.2 96.9 185.9
(1.35) (70.1) (55.1) (72.7) (52.7)
Number of cattle0 0.380 -422.3 -660.9
(0.73) (48.2) (54.7)
T = 2 42 13 13 13 10 13
T = 3 133 82 79 38 40 36
T = 4 550 362 362 327 362 327
R2 0.139 0.111 0.114 0.113 0.113 0.113
Mean of dependent variable -219 -219 -219 -219 -219 -219
N 1081 1958 1263 1257 1070 1176 1066

Cattle holding

In ReadTrimLivestockByExperienceANCOVA.R:

source(paste0(pathprogram, "ReadTrimLivestockByExperienceANCOVA.R"))
lvoEN = copy(lvoE)
FileName <- "NumCows"
FileNameHeader <- c("", "PovertyStatus", "Attributes",
  "TimeVarying", "TimeVaryingAttributes",
  "TimeVaryingPovertyStatus", "TimeVaryingPovertyStatusAttributes")
regsuffixes <- c("", "P", "a", "T", "Ta", "TP", "TPa")
listheader <- paste0("nae", regsuffixes)
source(paste0(pathprogram, "NumCowsCovariateSelectionANCOVA2.R"))
jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
DataToUse1 <- DataToUse2 <- rep("lvoEN", 7)
Addseparatingcols <- NULL; Separatingcolwidth <- NULL
Separatingcoltitle <- NULL
Regressands <- rep("NumCows", jay)
tableboxwidth <- 4.5
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
#### source(paste0(pathprogram, "DisplayCovariates.R"))
dig.depmean <- 2
AddMeanStdColumn <- UseRawDataForDestat <- T
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
Click here to see the results table on net non-livestock assets..

NumCows, TimeVarying

covariates mean/std 1 2 3 4
(Intercept) 1.47 1.36 1.12 1.11
(0.0) (0.0) (0.0) (0.0)
Large 0.273 0.39 0.37 0.35 0.35
(0.45) (0.6) (0.4) (0.8) (0.8)
LargeGrace 0.248 0.01 0.02 0.02 0.03
(0.43) (94.3) (88.5) (83.9) (82.5)
Cattle 0.264 -0.05 -0.03 -0.03 -0.03
(0.44) (44.1) (72.3) (67.5) (69.1)
HadCattle 0.195 0.14
(0.40) (45.4)
rd 3 0.348 -0.02 0.00 0.00 0.01
(0.48) (71.4) (96.9) (93.8) (91.5)
Large \(\times\) rd 3 0.094 -0.05 -0.05 -0.05 -0.05
(0.29) (74.9) (75.5) (77.9) (77.2)
LargeGrace \(\times\) rd 3 0.085 0.19 0.20 0.21 0.21
(0.28) (28.5) (25.5) (24.9) (25.1)
Cattle \(\times\) rd 3 0.091 0.17 0.16 0.16 0.15
(0.29) (18.0) (23.6) (24.6) (25.3)
rd 4 0.326 0.16 0.18 0.19 0.19
(0.47) (0.9) (0.5) (0.4) (0.4)
Large \(\times\) rd 4 0.094 0.05 0.04 0.05 0.05
(0.29) (74.5) (79.1) (78.2) (78.7)
LargeGrace \(\times\) rd 4 0.081 0.40 0.39 0.40 0.40
(0.27) (3.3) (3.6) (3.0) (3.0)
Cattle \(\times\) rd 4 0.085 0.34 0.34 0.35 0.35
(0.28) (0.8) (1.1) (1.1) (1.2)
HadCattle 0.195 0.14
(0.40) (45.4)
Flood in round 1 0.491 0.05 0.05
(0.50) (57.2) (56.4)
Head literate0 0.114 0.02 0.02
(0.32) (85.6) (87.2)
Number of cattle0 0.266 0.31 0.29 0.21
(0.62) (0.2) (0.6) (21.4)
Household size0 4.219 0.05 0.05
(1.43) (3.7) (3.8)
Livestock value 5315.315
(12450.23)
T = 2 87 87 85 85
T = 3 168 168 168 168
T = 4 395 395 395 395
R2 0.040 0.086 0.089 0.089
Mean of dependent variable 1.62 1.62 1.62 1.62
N 1998 1608 1608 1606 1606

Net broad assets: Broad assets+Livestock-GUK Debt-Other Debts

Net broad assets = Broad assets + net saving - debt to GUK - debts to relatives and money lenders.

NeA1 <- readRDS(paste0(pathsaveHere, "NetAssetsRegData.rds"))
# Drop confusing variables
NeA1[, grepout("^NetValue|Narrow|^R", colnames(NeA1)) := NULL]
FileName <- "NetBroadAssets"
FileNameHeader <- c("", "PovertyStatus", "Attributes",
    "TimeVarying", "TimeVaryingAttributes",
  "TimeVaryingPovertyStatus", "TimeVaryingPovertyStatusAttributes")
regsuffixes <- c("", "P", "a", "T", "Ta", "TP", "TPa")
listheader <- paste0("nea", regsuffixes)
source(paste0(pathprogram, "NetBroadAssetCovariateSelectionANCOVA2.R"))
jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
DataToUse1 <- DataToUse2 <- rep("NeA1", jay)
if (Only800) NeA1 <- NeA1[o800 == 1L, ]
Addseparatingcols <- NULL; Separatingcolwidth <- NULL
Separatingcoltitle <- NULL
Regressands <- rep("NetBroadValue", jay)
tableboxwidth <- 4.5
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
dig.depmean <- 0
AddMeanStdColumn <- UseRawDataForDestat <- T
NeA1[, grepout("Net2", colnames(NeA1)) := NULL]
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))

We also examine net asset annual price ANCOVA estimation.

NeA1R <- readRDS(paste0(pathsaveHere, "NetAssetsANCOVATrimmed.rds"))
NeA1R2 <- readRDS(paste0(pathsaveHere, "NetAssetsANCOVA.rds"))
if (UseTrimmedSample) NeA1 <- NeA1R2[tee > 1, ] else NeA1 <- NeA1R[tee > 1, ]
NeA1[, grepout("RM|NetV", colnames(NeA1)) := NULL]
FileName <- "NetAssetsAnnualPrices"
Regressands <- rep("Net2Value", jay)
if (Only800) NeA1 <- NeA1[o800 == 1L, ]
AddMeanStdColumn <- UseRawDataForDestat <- T
source(paste0(pathprogram, "NetAssetCovariateSelectionANCOVA2.R"))
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))

Net assets, experienced vs. inexperienced

####  Below data is created in ReadTrimLivestockANCOVA.R 
####  in livestock regression preparation
lvo0 <- readRDS(paste0(pathsaveHere, "NumCowRegData.rds"))
LvEx <- readRDS(paste0(pathsaveHere, "LivestockExperienceAtBaseline.rds"))
lv00 <- unique(lvo0[, .(hhid, o800, NumCows0)])
setkey(lv00, hhid); setkey(LvEx, hhid)
lvLv <- LvEx[lv00]
####  NAs in LeaseInCattle, OwnCattle are due to missing obs in stata file: fnlv0
#### addmargins(table0(lvLv[o800==1L, .(NumCows0, LeaseInCattle)]))

Tabulation of cattle lease-in and its experience at baseline.

addmargins(table0(lvLv[o800==1L, .(YearsSinceLastAdi, LeaseInCattle)]))
                 LeaseInCattle
YearsSinceLastAdi   0   1 <NA> Sum
             1      3   0    0   3
             2     13   0    0  13
             3      8   0    0   8
             <NA> 654  94    2 750
             Sum  678  94    2 774

In below, we will define Adi as LeasInCattle \(==\) 1 or has experience of Adi in last 3 years.

Click here to see the code that defines Adi.

Even LeaseInCattle \(==\) 0 & OwnCattle \(==\) 0, some had Adi experiences.

addmargins(table0(lvLv[o800==1L & LeaseInCattle == 0, .(YearsSinceLastAdi, OwnCattle)]))
                 OwnCattle
YearsSinceLastAdi   0   1 Sum
             1      1   2   3
             2     11   2  13
             3      6   2   8
             <NA> 483 171 654
             Sum  501 177 678

Recode LeaseInCattle if OwnCattle == 0 & \(!\)is.na(YearsSinceLastAdi). This means, LeaseInCattle is given the value of 1 if OwnCattle = 0 but has experience of Adi in last 3 years.

If we (and we will) assume that the NumCows0 (computed from abu_livestockownershipupdated.dta) as the truth, there are 52 false positives in OwnCattle (falsely reporting cattle ownership at baseline).

addmargins(table0(lvLv[o800==1L, .(NumCows0, OwnCattle)]))
        OwnCattle
NumCows0   0   1 <NA> Sum
     0   581  52    0 633
     1     0 100    1 101
     2     0  30    0  30
     3     0   6    0   6
     4     0   2    1   3
     5     0   1    0   1
     Sum 581 191    2 774
Click here to see the code that redefines number of cattle and Adi.

NumCows are computed in read_clean_data.rnw by:

xloL[, NumCows := as.integer(NA)]  
xloL[grepl("ow", LVcode), NumCows := as.integer(number_owned)]  
xloL[, NumCows := NumCows[grepl("ow", LVcode)], by = .(hhid, survey)]  

xloL is the raw data file abu_livestockownershipupdated.dta.

We will correct baseline data such that it becomes consistent with abu_livestockownershipupdated.dta. We define a binary variable OwnCattle and drop NumCows0. Dropping NumCows0 is only for net asset by experience estimation. We still use NumCows0 for cattle by experience estimation.

lvLv[NumCows0 == 0 & OwnCattle == 1L, OwnCattle := 0L]  
lvLv[NumCows0 > 0 & is.na(OwnCattle), OwnCattle := 1L]  
lvLv[, NumCows0 := NULL]

We will also correct LeaseInCattle from NA to 0, if NumCows0 \(>0\) (2 cases). Save it as LivestockExperienceAtBaselineCorrected.rds, and use it in estimation as shown below.

lvLv[NumCows0 == 0 & OwnCattle == 1L, OwnCattle := 0L]
lvLv[NumCows0 > 0 & is.na(OwnCattle), OwnCattle := 1L]
lvLv[NumCows0 > 0 & is.na(LeaseInCattle), LeaseInCattle := 0L]
lvLv[, NumCows0 := NULL]
lvLv[OwnCattle == 0L & !is.na(YearsSinceLastAdi), LeaseInCattle := 1L]
addmargins(table0(lvLv[o800==1L & LeaseInCattle == 0L, .(YearsSinceLastAdi, OwnCattle)]))
                 OwnCattle
YearsSinceLastAdi   0   1 Sum
             1      0   2   2
             2      0   2   2
             3      0   2   2
             <NA> 521 135 656
             Sum  521 141 662
addmargins(table0(lvLv[o800==1L, .(LeaseInCattle, OwnCattle)]))
             OwnCattle
LeaseInCattle   0   1 Sum
          0   521 141 662
          1   112   0 112
          Sum 633 141 774
saveRDS(lvLv, paste0(pathsaveHere, "LivestockExperienceAtBaselineCorrected.rds"))

In MergeAllNetAssetsExperienceANCOVA.R:

source(paste0(pathprogram, "MergeAllNetAssetsExperienceANCOVA.R"))
FileName <- "NetAssetsExperience"
FileNameHeader <- c("", "PovertyStatus", "Attributes",
  "TimeVarying", "TimeVaryingAttributes",
  "TimeVaryingPovertyStatus", "TimeVaryingPovertyStatusAttributes")
regsuffixes <- c("", "P", "a", "T", "Ta", "TP", "TPa")
listheader <- paste0("nae", regsuffixes)
source(paste0(pathprogram, "NetAssetExperienceCovariateSelectionANCOVA2.R"))
jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
NeAE1 <- readRDS(paste0(pathsaveHere, "NetAssetsExperienceRegData.rds"))
NeAE1[, grepout("Net2|^Narr", colnames(NeAE1)) := NULL]
DataToUse1 <- DataToUse2 <- rep("NeAE1", jay)
Addseparatingcols <- NULL; Separatingcolwidth <- NULL
Separatingcoltitle <- NULL
Regressands <- rep("NetValue", jay)
tableboxwidth <- 4.5
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
if (Only800) NeAE1 <- NeAE1[o800 == 1L, ]
dig.depmean <- 0
AddMeanStdColumn <- UseRawDataForDestat <- T
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
FileName0 <- "NetAssetsByExperience"
FileNameHeader <- c("", "PovertyStatus", "Attributes",
  "TimeVarying", "TimeVaryingAttributes",
  "TimeVaryingPovertyStatus", "TimeVaryingPovertyStatusAttributes")
NeAE1 <- readRDS(paste0(pathsaveHere, "NetAssetsExperienceRegData.rds"))
NeAE1[, grepout("Net2|^Narr", colnames(NeAE1)) := NULL]
if (Only800) NeAE1 <- NeAE1[o800 == 1L, ]
NeAE1o <- NeAE1[OwnCattle0 == 1L, ]
NeAE1a <- NeAE1[AdiCattle0 == 1L, ]
NeAE1n <- NeAE1[!(OwnCattle0 == 1L | AdiCattle0 == 1L), ]
Addseparatingcols <- NULL; Separatingcolwidth <- NULL
Separatingcoltitle <- NULL
tableboxwidth <- 4.5
dig.depmean <- 0
FileNameHeader <- c("", "PovertyStatus", "Attributes",
  "TimeVarying", "TimeVaryingAttributes",
  "TimeVaryingPovertyStatus", "TimeVaryingPovertyStatusAttributes")
regsuffixes <- c("", "P", "a", "T", "Ta", "TP", "TPa")
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
for (mm in c("a", "o", "n"))
{
  CreateHTMLTable <- T
  listheader <- paste0("naBe", mm, regsuffixes)
  FileName <- paste0(FileName0, mm)
  source(paste0(pathprogram, "NetAssetByExperienceCovariateSelectionANCOVA2.R"))
  # No dummyHadCow or NumCattle0, reg spec m = 1, .., jay(= 4)
  jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
  DataToUse1 <- DataToUse2 <- rep(paste0("NeAE1", mm), jay)
  Regressands <- rep("NetValue", jay)
  AddMeanStdColumn <- UseRawDataForDestat <- T
  source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
}
centerBox <- 1.1
for (k in 1:length(listheader)) {
  etba <- get(paste0("etba", k)) # adi subsample
  etbo <- get(paste0("etbo", k)) # own subsample
  etbn <- get(paste0("etbn", k)) # no adi nor own subsample
  ##  etba[, 1][!etba[, 1] %in% etbo[, 1]]: only etba has UP and its time interactions
  etb1 <- cbind(
    etba[, 1:2], etbo[, 2], etbn[, 2], 
    etba[, 3], etbo[, 3], etbn[, 3]
    )
  etb2 <- cbind(
    etba[, c(1, 4)], etbo[, 4], etbn[, 4], 
    etba[, 5], etbo[, 5], etbn[, 5]
    )
  ltb1 <- latextab(etb1, 
    hleft = "\\scriptsize\\hfil$", 
    hcenter = c(3.25, rep(centerBox, ncol(etb1)-1)), hright = "$", 
    headercolor = "gray80", adjustlineskip = "-.6ex", delimiterline= NULL,
    alternatecolor2 = "gray90", 
    addseparatingcols = 3, 
    separatingcolwidth = .05, 
    separatingcoltitle = c("mean/std", "(1)"), 
    addsubcoltitlehere = T)
  ltb2 <-  latextab(etb2, 
    hleft = "\\scriptsize\\hfil$", 
    hcenter = c(3.25, rep(centerBox, ncol(etb2)-1)), hright = "$", 
    headercolor = "gray80", adjustlineskip = "-.6ex", delimiterline= NULL,
    alternatecolor2 = "gray90", 
    addseparatingcols = c(3), 
    separatingcolwidth = .05, 
    separatingcoltitle = c("(2)", "(3)"), 
    addsubcoltitlehere = T)
####   ltb1[2] <- paste0(ltb1[2], "\\rowcolor{gray80}")
####   ltb2[2] <- paste0(ltb2[2], "\\rowcolor{gray80}")
  ltb1 <- c(
    ltb1[1:3, ],
    paste(
      "\\rowcolor{gray80}&", 
      paste(
        c(paste("\\makebox[", centerBox, "cm]{\\scriptsize\\sf\\hfil", 
          c("Adi", "Own", "None"), "}")
        , "",
        paste("\\makebox[", centerBox, "cm]{\\scriptsize\\sf\\hfil", 
          c("Adi", "Own", "None"), "}"))
        , collapse = "&")
      , "\\\\[-.0ex]", collapse = ""),
    ltb1[-(1:4), ]
    )
  ltb2 <- c(
    ltb2[1:3, ],
    paste(
      "\\rowcolor{gray80}&", 
      paste(
        c(paste("\\makebox[", centerBox, "cm]{\\scriptsize\\sf\\hfil", 
          c("Adi", "Own", "None"), "}")
        , "",
        paste("\\makebox[", centerBox, "cm]{\\scriptsize\\sf\\hfil", 
          c("Adi", "Own", "None"), "}"))
        , collapse = "&")
      , "\\\\[-.6ex]", collapse = ""),
    ltb2[-(1:4), ]
    )
  write.tablev(ltb1, 
    paste0(pathsaveHere, FileName0, 1, 
      FileNameHeader[k], "ANCOVAEstimationResults.tex")
    , colnamestrue = F)
  write.tablev(ltb2, 
    paste0(pathsaveHere, FileName0, 2, 
      FileNameHeader[k], "ANCOVAEstimationResults.tex")
    , colnamestrue = F)
}
Click here to see the code of results table on net assets of owners. Net assets: Owners

NetAssetsByExperienceo, TimeVarying

covariates mean/std 1 2 3 4
(Intercept) 27409.7 21652.1 21758.4 21758.4
(0.0) (1.4) (12.5) (12.5)
Large 0.343 21672.9 22742.5 23397.4 23397.4
(0.48) (1.0) (3.7) (3.7) (3.7)
LargeGrace 0.269 10698.8 6710.7 7870.4 7870.4
(0.44) (4.5) (28.2) (23.0) (23.0)
Cattle 0.202 7598.3 8695.5 9309.2 9309.2
(0.40) (12.1) (13.6) (11.6) (11.6)
rd 3 0.343 -213.2 58.2 729.8 729.8
(0.48) (93.6) (98.4) (79.5) (79.5)
Large \(\times\) rd 3 0.114 -795.1 -733.2 899.9 899.9
(0.32) (92.5) (93.6) (92.3) (92.3)
LargeGrace \(\times\) rd 3 0.091 -12060.0 -14784.7 -14244.5 -14244.5
(0.29) (18.9) (14.8) (16.7) (16.7)
Cattle \(\times\) rd 3 0.071 -3022.4 -1784.8 -1935.2 -1935.2
(0.26) (69.3) (83.3) (82.1) (82.1)
rd 4 0.327 395.2 2214.8 2220.8 2220.8
(0.47) (90.1) (51.7) (51.5) (51.5)
Large \(\times\) rd 4 0.114 4756.1 1553.1 1053.4 1053.4
(0.32) (62.9) (88.6) (92.4) (92.4)
LargeGrace \(\times\) rd 4 0.091 -9613.7 -14395.7 -13720.6 -13720.6
(0.29) (32.9) (22.8) (25.2) (25.2)
Cattle \(\times\) rd 4 0.061 1293.0 1204.4 845.8 845.8
(0.24) (87.5) (90.1) (93.2) (93.2)
Flood in round 1 0.444 1288.0 1288.0
(0.50) (82.4) (82.4)
Head literate0 0.165 -3614.3 -3614.3
(0.37) (53.2) (53.2)
NetValue0 31070.976 0.2 0.2 0.2
(15261.17) (26.2) (29.1) (29.1)
Household size0 4.586 -380.9 -380.9
(1.41) (88.0) (88.0)
T = 2 6 1 1 1
T = 3 17 11 9 9
T = 4 113 92 92 92
R2 0.054 0.070 0.062 0.062
Mean of dependent variable 39185 39185 39185 39185
N 297 379 299 295 295
Click here to see the code of results table on net assets of adi. Net assets: Adi

NetAssetsByExperiencea, TimeVarying

covariates mean/std 1 2 3 4
(Intercept) 26892.0 31829.0 3882.8 3882.8
(0.0) (0.0) (74.2) (74.2)
Large 0.327 2749.7 -1183.5 -3319.5 -3319.5
(0.47) (59.1) (85.9) (60.3) (60.3)
LargeGrace 0.135 1949.7 -1798.0 -2794.4 -2794.4
(0.34) (75.5) (89.5) (78.9) (78.9)
Cattle 0.316 1985.9 -3240.6 -3402.0 -3402.0
(0.47) (66.0) (61.8) (63.7) (63.7)
rd 3 0.345 -977.4 -2205.1 -1217.6 -1217.6
(0.48) (71.3) (53.4) (72.3) (72.3)
Large \(\times\) rd 3 0.111 -8254.5 -2352.8 -2595.9 -2595.9
(0.32) (36.9) (83.8) (82.1) (82.1)
LargeGrace \(\times\) rd 3 0.047 -1387.6 18024.1 19783.2 19783.2
(0.21) (82.5) (2.6) (0.2) (0.2)
Cattle \(\times\) rd 3 0.111 -3657.0 4495.1 3908.1 3908.1
(0.32) (50.7) (40.5) (44.4) (44.4)
rd 4 0.333 921.9 881.3 2324.8 2324.8
(0.47) (79.6) (87.3) (68.1) (68.1)
Large \(\times\) rd 4 0.111 -601.7 2635.2 2269.7 2269.7
(0.32) (95.4) (82.9) (85.4) (85.4)
LargeGrace \(\times\) rd 4 0.047 5087.7 28494.3 30131.0 30131.0
(0.21) (62.0) (12.5) (10.3) (10.3)
Cattle \(\times\) rd 4 0.105 -767.4 4039.4 5068.8 5068.8
(0.31) (90.9) (51.4) (41.3) (41.3)
Flood in round 1 0.526 -10818.3 -10818.3
(0.50) (2.3) (2.3)
Head literate0 0.135 6543.4 6543.4
(0.34) (37.6) (37.6)
NetValue0 1344.942 0.7 0.7 0.7
(6621.59) (0.8) (0.1) (0.1)
Household size0 4.573 7114.2 7114.2
(1.24) (0.5) (0.5)
T = 2 9 2 2 2
T = 3 18 10 10 10
T = 4 83 48 48 48
R2 -0.031 -0.018 0.105 0.105
Mean of dependent variable 28555 28555 28555 28555
N 171 294 166 166 166
Click here to see the code of results table on net assets of others. Net assets: Others

NetAssetsByExperiencen, TimeVarying

covariates mean/std 1 2 3 4
(Intercept) 13260.5 12537.5 4176.1 4176.1
(0.0) (0.0) (26.4) (26.4)
Large 0.262 10201.1 10945.5 10379.3 10379.3
(0.44) (0.0) (0.0) (0.1) (0.1)
LargeGrace 0.253 5386.3 6652.8 6186.8 6186.8
(0.44) (3.6) (2.9) (4.3) (4.3)
Cattle 0.271 5126.8 3695.7 3145.2 3145.2
(0.44) (2.7) (19.4) (26.0) (26.0)
rd 3 0.354 3679.8 3679.9 3846.2 3846.2
(0.48) (0.0) (0.8) (0.7) (0.7)
Large \(\times\) rd 3 0.090 -3863.7 -2643.4 -2637.7 -2637.7
(0.29) (17.0) (46.5) (46.9) (46.9)
LargeGrace \(\times\) rd 3 0.088 2699.0 5097.1 5230.4 5230.4
(0.28) (29.1) (19.8) (19.1) (19.1)
Cattle \(\times\) rd 3 0.098 -2475.6 -1924.8 -1778.2 -1778.2
(0.30) (39.5) (59.7) (62.3) (62.3)
rd 4 0.335 4520.5 3812.7 3994.3 3994.3
(0.47) (0.0) (0.9) (0.7) (0.7)
Large \(\times\) rd 4 0.090 -3983.4 -2233.2 -2250.4 -2250.4
(0.29) (21.3) (49.0) (48.8) (48.8)
LargeGrace \(\times\) rd 4 0.087 2886.7 6145.4 6359.5 6359.5
(0.28) (31.8) (15.8) (14.5) (14.5)
Cattle \(\times\) rd 4 0.093 791.6 2075.6 2256.1 2256.1
(0.29) (78.1) (54.9) (51.2) (51.2)
Flood in round 1 0.396 1142.1 1142.1
(0.49) (60.8) (60.8)
Head literate0 0.142 746.4 746.4
(0.35) (79.6) (79.6)
NetValue0 2746.425 0.3 0.3 0.3
(3434.12) (32.7) (38.7) (38.7)
Household size0 4.382 1887.2 1887.2
(1.37) (0.9) (0.9)
T = 2 27 10 10 10
T = 3 97 60 60 60
T = 4 354 222 222 222
R2 0.031 0.034 0.045 0.045
Mean of dependent variable 21496 21496 21496 21496
N 809 1283 796 796 796

Cattle holding, experienced vs. inexperienced

Number of cattle holding at baseline by experience

0 1 2 3 4 5 Sum
Adi 108 0 0 0 0 0 108
None 484 0 0 0 0 0 484
Owner 0 99 30 5 3 1 138
Sum 592 99 30 5 3 1 730
source(paste0(pathprogram, "ReadTrimLivestockByExperienceANCOVA.R"))
remove(list = ls(pattern = "^incl.?\\d"))
lvoEN = copy(lvoE) # all periods
lvo3EN = copy(lvo3E) # period 4 only
lvoEN[, grepout("TotalImp.*Value$|Self|edV.*0", colnames(lvoEN)) := NULL]
lvo3EN[, grepout("TotalImp.*Value$|Self|edV.*0", colnames(lvo3EN))  := NULL]
#### consistency between cattle ownership/leaseship 
#### at baseline and livestock holding information
lvoEN[, Cattle := "None"]
lvoEN[OwnCattle == 1L, Cattle := "Own"]
lvoEN[AdiCattle == 1L, Cattle := "Adi"]
addmargins(table0(lvoEN[tee == 2, .(Cattle, NumCows0)]))
      NumCows0
Cattle   0   1   2   3   4   5 Sum
  Adi  108   0   0   0   0   0 108
  None 484   0   0   0   0   0 484
  Own    0  99  30   5   3   1 138
  Sum  592  99  30   5   3   1 730
FileName <- "NumCowsExperience"
FileNameHeader <- c("", "PovertyStatus", "Attributes",
  "TimeVarying", "TimeVaryingAttributes",
  "TimeVaryingPovertyStatus", "TimeVaryingPovertyStatusAttributes")
regsuffixes <- c("", "P", "a", "T", "Ta", "TP", "TPa")
listheader <- paste0("nae", regsuffixes)
source(paste0(pathprogram, "NumCowsExperienceCovariateSelectionANCOVA2.R"))
jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
DataToUse1 <- DataToUse2 <- rep("lvoEN", 7)
Addseparatingcols <- NULL; Separatingcolwidth <- NULL
Separatingcoltitle <- NULL
Regressands <- rep("NumCows", jay)
tableboxwidth <- 4.5
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
dig.depmean <- 0
AddMeanStdColumn <- UseRawDataForDestat <- T
source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
FileName0 <- "NumCowsByExperience"
Regressands <- rep("NumCows", 7)
DataToUse1 <- rep("lvoEN", 7)
DataToUse2 <- rep("lvoE3N", 7)
FileNameHeader <- c("", "PovertyStatus", "Attributes",
    "TimeVarying", "TimeVaryingAttributes")
regsuffixes <- c("", "P", "a", "T", "Ta")
listheader <- paste0("cowE", regsuffixes)
exclheader <- paste0("excl", regsuffixes)
inclheader <- gsub("ex", "in", exclheader)
dig.depmean <- 2
if (any(grepl("NumCowsOwnedAtRd1", colnames(lvoEN)))) 
  setnames(lvoEN, "NumCowsOwnedAtRd1", "NumCows0")
#### numcows subsample by experience: own, adi, none
lvoENo <- lvoEN[OwnCattle == 1L, ]
lvoENa <- lvoEN[AdiCattle == 1L, ]
lvoENn <- lvoEN[!(OwnCattle == 1L | AdiCattle == 1L), ]
lvo3ENo <- lvo3EN[OwnCattle == 1L, ]
lvo3ENa <- lvo3EN[AdiCattle == 1L, ]
lvo3ENn <- lvo3EN[!(OwnCattle == 1L | AdiCattle == 1L), ]
Addseparatingcols <- NULL; Separatingcolwidth <- NULL
Separatingcoltitle <- NULL
tableboxwidth <- 4.5
dig.depmean <- 0
for (mm in c("a", "o", "n"))
{
  CreateHTMLTable <- T
  listheader <- paste0("cowE", mm, regsuffixes)
  FileName <- paste0(FileName0, mm)
  if (mm == "o") 
    source(paste0(pathprogram, 
      "NumCowsByExperienceForOwnCovariateSelectionANCOVA2.R")) else
    source(paste0(pathprogram, 
      "NumCowsByExperienceForAdiNoneCovariateSelectionANCOVA2.R"))
  jay <- max(as.numeric(gsub("incl", "", ls(pattern = "^incl\\d"))))
  DataToUse1 <- rep(paste0("lvoEN", mm), jay)
  DataToUse2 <- rep(paste0("lvo3EN", mm), jay)
  exclheader <- paste0("excl", regsuffixes)
  inclheader <- gsub("ex", "in", exclheader)
  AddMeanStdColumn <- UseRawDataForDestat <- T
  source(paste0(pathprogram, "ANCOVAEstimationFile3.R"))
}
centerBox <- 1.1
for (k in 1:length(listheader)) {
  etba <- get(paste0("etba", k)) # adi subsample
  etbo <- get(paste0("etbo", k)) # own subsample
  etbn <- get(paste0("etbn", k)) # no adi nor own subsample
  # fill in empty rows to conform with own subsample
  etba <- rbind(etba[1:grep("p.*HeadL", names(etba[, 1])), ], "", "", 
    etba[-(1:grep("p.*HeadL", names(etba[, 1]))), ])
  etbn <- rbind(etbn[1:grep("p.*HeadL", names(etbn[, 1])), ], "", "", 
    etbn[-(1:grep("p.*HeadL", names(etbn[, 1]))), ])
  etb1 <- cbind(
    etbo[, 1], # covariate names
    etba[, 2], etbo[, 2], etbn[, 2], 
    etba[, 3], etbo[, 3], etbn[, 3]
    )
  etb2 <- cbind(
    etbo[, 1], 
    etba[, 4], etbo[, 4], etbn[, 4], 
    etba[, 5], etbo[, 5], etbn[, 5] 
    )
  ltb1 <- latextab(etb1, 
    hleft = "\\scriptsize\\hfil$", 
    hcenter = c(3.25, rep(centerBox, ncol(etb1)-1)), hright = "$", 
    headercolor = "gray80", adjustlineskip = "-.6ex", delimiterline= NULL,
    alternatecolor2 = "gray90", 
    addseparatingcols = 3, 
    separatingcolwidth = .05, 
    separatingcoltitle = c("mean/std", "(1)"), 
    addsubcoltitlehere = T)
  ltb2 <-  latextab(etb2, 
    hleft = "\\scriptsize\\hfil$", 
    hcenter = c(3.25, rep(centerBox, ncol(etb2)-1)), hright = "$", 
    headercolor = "gray80", adjustlineskip = "-.6ex", delimiterline= NULL,
    alternatecolor2 = "gray90", 
    addseparatingcols = c(3), 
    separatingcolwidth = rep(.05, 1),
    separatingcoltitle = c("(2)", "(3)"), 
    addsubcoltitlehere = T)
  ltb1 <- c(
    ltb1[1:3, ],
    paste(
      "\\rowcolor{gray80}&", 
      paste(
        c(paste("\\makebox[", centerBox, "cm]{\\scriptsize\\sf\\hfil", 
          c("Adi", "Own", "None"), "}")
        , "",
        paste("\\makebox[", centerBox, "cm]{\\scriptsize\\sf\\hfil", 
          c("Adi", "Own", "None"), "}"))
        , collapse = "&")
      , "\\\\[-.0ex]", collapse = ""),
    ltb1[-(1:4), ]
    )
  ltb2 <- c(
    ltb2[1:3, ],
    paste(
      "\\rowcolor{gray80}&", 
        paste(c(paste("\\makebox[", centerBox, "cm]{\\scriptsize\\sf\\hfil", 
          c("Adi", "Own", "None"), "}")
        , "&"), collapse = "&")
      ,
        paste(c(paste("\\makebox[", centerBox, "cm]{\\scriptsize\\sf\\hfil", 
          c("Adi", "Own", "None"), "}")
          ), collapse = "&")
      , 
      "\\\\[-.6ex]", collapse = ""),
    ltb2[-(1:4), ]
    )
  write.tablev(ltb1, 
    paste0(pathsaveHere, FileName0, 1, 
      FileNameHeader[k], "ANCOVAEstimationResults.tex")
    , colnamestrue = F)
  write.tablev(ltb2, 
    paste0(pathsaveHere, FileName0, 2, 
      FileNameHeader[k], "ANCOVAEstimationResults.tex")
    , colnamestrue = F)
}
Click here to see the code of results table on owned cattle of owners. Number of owned cattle: Owners

NumCowsByExperienceo, TimeVarying

covariates mean/std 1 2 3
(Intercept) 1.50 1.20 1.35
(0.0) (0.0) (2.2)
Large 0.342 0.92 0.89 0.89
(0.48) (0.9) (0.9) (9.1)
LargeGrace 0.268 0.37 0.36 0.20
(0.44) (3.8) (6.1) (50.0)
Cattle 0.200 0.13 0.14 0.10
(0.40) (40.1) (40.9) (68.2)
rd 3 0.346 0.04 0.04 -0.00
(0.48) (73.8) (72.2) (96.9)
Large \(\times\) rd 3 0.115 0.10 0.11 0.20
(0.32) (75.9) (73.9) (57.5)
LargeGrace \(\times\) rd 3 0.092 0.07 0.11 0.06
(0.29) (83.8) (75.6) (88.2)
Cattle \(\times\) rd 3 0.071 0.29 0.30 0.24
(0.26) (30.4) (28.4) (37.3)
rd 4 0.319 0.14 0.14 0.09
(0.47) (29.1) (29.1) (48.6)
Large \(\times\) rd 4 0.112 0.19 0.18 0.15
(0.32) (63.0) (64.6) (71.1)
LargeGrace \(\times\) rd 4 0.088 -0.08 -0.07 -0.18
(0.28) (83.4) (84.0) (61.3)
Cattle \(\times\) rd 4 0.061 0.38 0.41 0.20
(0.24) (20.0) (16.8) (48.5)
Flood in round 1 0.447 0.06
(0.50) (83.1)
Head literate0 0.166 -0.18
(0.37) (53.7)
Number of cattle0 1.420 0.23 -0.74
(0.71) (10.6) (8.2)
NetValue0 30907.220 0.00
(15484.74) (1.2)
Household size0 4.563 0.01
(1.42) (94.8)
T = 2 13 13 6
T = 3 16 16 12
T = 4 104 104 79
R2 0.058 0.070 0.060
Mean of dependent variable 2 2 2
N 295 357 357 267
Click here to see the code of results table on owned cattle of Adi. Number of owned cattle: Adi

NumCowsByExperiencea, TimeVarying

covariates mean/std 1 2 3
(Intercept) 1.60 1.60 0.98
(0.0) (0.0) (1.9)
Large 0.333 -0.02 -0.02 -0.03
(0.47) (91.5) (91.5) (91.7)
LargeGrace 0.127 0.22 0.22 0.59
(0.33) (45.2) (45.2) (16.6)
Cattle 0.321 -0.12 -0.12 -0.05
(0.47) (56.3) (56.3) (87.2)
rd 3 0.352 -0.09 -0.09 -0.16
(0.48) (37.2) (37.2) (32.4)
Large \(\times\) rd 3 0.115 -0.23 -0.23 -0.54
(0.32) (56.4) (56.4) (29.2)
LargeGrace \(\times\) rd 3 0.048 -0.15 -0.15 0.12
(0.22) (62.1) (62.1) (75.0)
Cattle \(\times\) rd 3 0.109 0.04 0.04 -0.16
(0.31) (91.4) (91.4) (68.7)
rd 4 0.315 0.27 0.27 0.38
(0.47) (10.6) (10.6) (23.0)
Large \(\times\) rd 4 0.115 -0.00 -0.00 -0.21
(0.32) (99.8) (99.8) (69.5)
LargeGrace \(\times\) rd 4 0.036 0.30 0.30 1.37
(0.19) (58.7) (58.7) (21.6)
Cattle \(\times\) rd 4 0.103 0.10 0.10 -0.06
(0.30) (79.1) (79.1) (87.6)
Flood in round 1 0.533 -0.35
(0.50) (15.2)
Head literate0 0.133 0.39
(0.34) (22.1)
NetValue0 959.667 0.00
(8196.80) (1.8)
Household size0 4.655 0.16
(1.17) (5.3)
T = 2 13 13 8
T = 3 24 24 12
T = 4 64 64 35
R2 0.007 0.007 0.094
Mean of dependent variable 2 2 2
N 165 253 253 137
Click here to see the code of results table on owned cattle of others. Number of owned cattle: Others

NumCowsByExperiencen, TimeVarying

covariates mean/std 1 2 3
(Intercept) 1.41 1.41 1.29
(0.0) (0.0) (0.0)
Large 0.268 0.25 0.25 0.07
(0.44) (3.1) (3.1) (68.4)
LargeGrace 0.254 -0.13 -0.13 -0.09
(0.44) (28.3) (28.3) (56.8)
Cattle 0.278 -0.08 -0.08 -0.17
(0.45) (38.6) (38.6) (25.6)
rd 3 0.349 0.01 0.01 -0.06
(0.48) (90.1) (90.1) (33.0)
Large \(\times\) rd 3 0.091 -0.01 -0.01 0.20
(0.29) (92.5) (92.5) (28.8)
LargeGrace \(\times\) rd 3 0.088 0.35 0.35 0.33
(0.28) (5.9) (5.9) (7.1)
Cattle \(\times\) rd 3 0.095 0.18 0.18 0.30
(0.29) (17.1) (17.1) (7.4)
rd 4 0.327 0.17 0.17 0.10
(0.47) (0.6) (0.6) (11.3)
Large \(\times\) rd 4 0.091 0.05 0.05 0.16
(0.29) (75.3) (75.3) (37.2)
LargeGrace \(\times\) rd 4 0.083 0.61 0.61 0.58
(0.28) (0.2) (0.2) (0.3)
Cattle \(\times\) rd 4 0.091 0.42 0.42 0.47
(0.29) (0.2) (0.2) (0.7)
Flood in round 1 0.393 0.20
(0.49) (4.5)
Head literate0 0.129 0.00
(0.34) (97.7)
NetValue0 2795.554 -0.00
(3689.93) (89.4)
Household size0 4.346 0.04
(1.38) (23.8)
T = 2 61 61 31
T = 3 128 128 83
T = 4 227 227 134
R2 0.050 0.050 0.035
Mean of dependent variable 1 1 1
N 791 998 998 599

Inference

As a general idea, we test the following:

If the regression type is time-varying, we test:

Click here to see the a summary table of tested impacts and its code.
contab <- fread("../program/ConfiTableContents.prn")
contab <- do.call(cbind, lapply(contab, function(x) gsub("\\*", "\\\\*", x)))
library(kableExtra)
kt <- kable(contab, format = "html")
kt <- column_spec(kt, 1, extra_css = "vertical-align:top;")
kt <- column_spec(kt, 2, width = "5cm; min-width:5cm;", 
  extra_css = "vertical-align:top;")
kt <- column_spec(kt, 3, width = "8cm; min-width:8cm;", 
  extra_css = "vertical-align:top;")
kt <- column_spec(kt, 4, extra_css = "vertical-align:top;")
kt <- kable_classic(kt, html_font = "Cambria")
#### Below will put the table in the centre of a page. Not visually good.
#### full_width and position arguments are ignored in tufte for some reasons.
#### kt <- kable_paper(kt)
#### kt <- kable_styling(kt, fixed_thead = T, full_width = F, position = "left")
A list of tested hypotheses for impacts
Object What it does Typical terms Code
hvT0 Overall (period 2) level for trad [[1]]Intercept covadd.trad[[1]]
hvN0 Overall (period 2) level for nontrad arm [[1]]Intercept + dummyInKind covadd.nontrad[[1]]
hvN1 Arm - trad in period 2 [[1]][2] dummyInKind covadd.nontrad[[1]][2]
hvTinT Difference = 0 (of trad in time X relative to trad in time 2) [[2]]Time.4 covadd.trad[[i]]
hv trad in each period intercept + Time.T hv = hvT0 + hvTinT
hvNinT Difference = 0 (of arm g in time X relative to arm g at period 2). =hvN0 if period 2. [[2]]Time.4, dummyInKind.Time4 covadd.nontrad[[i]][c(1, 2)]
dhvNinT Difference = 0 (of Arm g and trad in time X) [[2]][1] dummyInKind.Time4 covadd.nontrad[[i]][2]
hvNinT2 difference = 0 (of arm g in time X relative to trad in time 2) [[2]] Arm + TimeX + Arm.TimeX hvN1+covadd.nontrad[[i]][c(1, 2)]
periNrelativeT Cumulative difference = 0 (of arm g and trad in time X) dummyInKind dummyInKind.TimeX for cumulative effects relative to trad in time X periNrelativeT=hvN1+dhvNinT
hvN2 Level of nontrad in time X = cumulative trad + relative to concurrent trad = 0 Intercept+TimeX+Arm+TimeX.Arm hvT0 + hvNinT
dhvJ0 Average difference = 0 (of experienced j and trad) dummyAdiCattle0 j
dhvJinT Difference = 0 (of experienced j and trad in period X) dummyAdiCattle0.TimeX paste0(^, j,.Time.$)
hvJinT Cumulative difference = 0 (of experience j and trad in period X) dummyAdiCattle0 + dummyAdiCattle0.TimeX dhvJ0+dhvJinT
hvJG0 Average difference = 0 (of experience*arm j*g and arm g) dummyAdiCattle0.Large paste0(^, j,$)
dhvJGinT Difference = 0 (of experience*arm j*g and arm g in period X) dummyAdiCattle0.Large.TimeX paste0(^, j, .’,covadd.nontrad[[i]][2])
hvJGinT Cumulative difference = 0 (of experience*arm j*g and arm g in period X) dummyAdiCattle0.Large+ dummyAdiCattle0.Large.TimeX hvJG0 + dhvJGinT
periJGinT Cumulative difference = 0 (of experience*arm j*g and trad in time X) dummyLarge + dummyLarge.TimeX+ dummyAdiCattle0 + dummyAdiCattle0.TimeX+ dummyAdiCattle0.Large+ dummyAdiCattle0.Large.TimeX periNrelativeT+hvJinT+hvJGinT
Click here to see the a summary table of tested schooling impacts and its code.
contab <- fread("../program/ConfiTableContents2.prn")
contab <- do.call(cbind, lapply(contab, function(x) gsub("\\*", "\\\\*", x)))
library(kableExtra)
kt <- kable(contab, format = "html")
kt <- column_spec(kt, 1, extra_css = "vertical-align:top;")
kt <- column_spec(kt, 2, width = "5cm; min-width:5cm;", 
  extra_css = "vertical-align:top;")
kt <- column_spec(kt, 3, width = "8cm; min-width:8cm;", 
  extra_css = "vertical-align:top;")
kt <- column_spec(kt, 4, extra_css = "vertical-align:top;")
kt <- kable_classic(kt, html_font = "Cambria")
A list of tested hypotheses for schooling impacts
Object What it does Typical terms Code
hvMofTA average change = 0 (of males in trad school i) Intercept + School = dMofT addcovaMofT[c(1, i)]
hvFofTA average change = 0 (of females in trad school i) Intercept + School + Female + School.Female = hvMofTA + dFofT hvMofTA + addcovaFofT[c(1, i)]
hvMofNA average change = 0 (of nontrad arm g at school i) intercept + Arm + School + Arm.School = hvMofTA + dMofNA hvMofTA + addcovaMofN[c(1, i)]
hvFofNA average change = 0 (of nontrad Arm g at School i for females) Intercept + Arm + School + Female + Arm.School + Arm.Female + School.Female + Arm.School.Female = Intercept + Arm + School + Arm.School (hvMofNA) + Female + School.Female (dFofT) + Arm.Female + Arm.School.Female (dFofNA) = hvMofNA + dFofT + dFofNA& hvMofNA + dFofT + addcovaFofN[c(1, i)]
hvMofN average difference = 0 (of nontrad Arm g relative to trad, at School i) hvMofNA - hvMofTA = Arm + Arm.School dMofNA
hvFofN difference = 0 (of nontrad Arm g females to trad females, at School i) hvFofNA - hvFofTA = Arm + School + Female + Arm.School + Arm.Female + School.Female + Arm.School.Female - (School + Female + School.Female) = Arm + Arm.School + Arm.Female + Arm.School.Female = hvMofNA + dFofNA hvMofNA + dFofNA
hvMofTinT difference = 0 (of trad in timeX relative to period 2, at School i) School + TimeX + School.TimeX - School = TimeX + School.TimeX addteeMofTinT[c(1 ,i)]
hvFofTinT difference = 0 (of female trad in timeX relative to period 2, at School i) School + TimeX + Female + School.TimeX + School.Female + Female.TimeX + School.Female.TimeX - (School + Female + School.Female)= TimeX + School.TimeX + Female.TimeX + School.Female.TimeX = hvMofTinT + FofTinT hvMofTinT + addteeFofTinT[c(1 ,i)]
hvMofTinTL cumulative change = 0 (of trad at school i in period X) Intercept + School + TimeX + School.TimeX = hvMofTA + hvMofTinT
hvFofTinTL cumulative change = 0 (of female trad at school i in period X) Intercept + School + Female + TimeX + School.TimeX + School.Female + Female.TimeX + School.Female.TimeX = hvFofTA + hvFofTinT
dMofNinT diff = 0 (of nontrad change relative to concurrent trad change, at school iin period X) TimeX + Arm.TimeX + School.TimeX + Arm.School.TimeX - (TimeX + School.TimeX) = Arm.TimeX + Arm.School.TimeX addteeMofNinT[c(1 ,i)]
dFofNinT diff = 0 (of female nontrad change relative to concurrent female trad change, at school i in period X) TimeX + Arm.TimeX + Female.TimeX + School.TimeX + Arm.School.TimeX + Arm.Female.TimeX + Female.School.TimeX + Arm.School.Female.TimeX - (TimeX + Female.TimeX + School.TimeX + Female.School.TimeX) = Arm.TimeX + Arm.School.TimeX + Arm.Female.TimeX + Arm.School.Female.TimeX = dMofNinT + Arm.Female.TimeX + Arm.School.Female.TimeX = dMofNinT + dFofNinT0 addteeFofNinT[c(1 ,i)]
hvMofNinT difference = 0 (of nontrad relative to concurrent trad, at school iin period X) Arm + School + TimeX + Arm.School + Arm.TimeX + School.TimeX + Arm.School.TimeX - (School + TimeX + School.TimeX)= Arm + Arm.School + Arm.TimeX + Arm.School.TimeX = hvMofN + dMofNinT hvMofN + dMofNinT
hvFofNinT difference = 0 (of female nontrad relative to concurrent female trad, at school iin period X) Arm + School + Female + TimeX + Arm.School + Arm.Female + Arm.TimeX + School.Female + School.TimeX + Female.TimeX + Arm.School.Female + Arm.School.TimeX + Arm.Female.TimeX + School.Female.TimeX + Arm.School.Female.TimeX - (School + Female + TimeX + School.Female + School.TimeX + Female.TimeX) = Arm + Arm.School (MofN) + Arm.Female + Arm.School.Female (dFofN) + Arm.TimeX + Arm.School.TimeX (dMofNinT)+ Arm.Female.TimeX + Arm.School.Female.TimeX (dFofNinT0) = hvMofN + dFofN + dMofNinT + dFofNinT0 = hvMofN + dFofN + dFofNinT hvMofN + dFofNA + dFofNinT
hvMofNinTL cumulative change = 0 (of nontrad school i in period X) (intercept) + Arm + School + TimeX + Arm.School + Arm.TimeX + School.TimeX + Arm.School.TimeX = hvMofTinTL + hvMofNinT
(intercept) + School + TimeX + School.TimeX (hvMofTinTL) + Arm + Arm.School (hvMofN)+ Arm.TimeX + Arm.School.TimeX (dMofNinT)
(intercept) + Arm + School + Arm.School (MofNA) + TimeX + School.TimeX (MofTinT) + Arm.TimeX + Arm.School.TimeX (dMofNinT)
hvFofNinTL cumulative change = 0 (of female nontrad school i in period X) (intercept) + Arm + School + Female + TimeX + Arm.School + Arm.Female + Arm.TimeX + School.Female + School.TimeX + Female.TimeX + Arm.School.Female + Arm.School.TimeX + Arm.Female.TimeX + School.Female.TimeX + Arm.School.Female.TimeX + Female + School.Female (dFofT) + Female.TimeX + School.Female.TimeX (dFofTinT) + Arm.Female + Arm.School.Female (dFofNA) + Arm.Female.TimeX + Arm.School.Female.TimeX (dFofNinT) = hvMofNinTL + dFofT + dFofTinT + dFofNA + dFofNinT
Click here to see the code for parameter setting.
lattributeList <- list(
  c("Large", "LargeGrace", "Cattle"),
  c("LargeSize", "WithGrace", "InKind")
  )
#### these are used for letting XX=Large, Cow, etc.
covadd0 <- list(c("\\(Intercept\\)", "dummyXX"), 
  c("Time.3", "dummyXX.Time3"),
  c("Time.4", "dummyXX.Time4"))
covaddsav <- list(c("\\(Intercept\\)", "dummyXX"), 
  c("LY2", "dummyXX.LY2"), # LY is loan year
  c("LY3", "dummyXX.LY3"),
  c("LY4", "dummyXX.LY4"))
covaddsch <- list(
  # male, traditional (MofT)
  MofT=c("\\(Intercept\\)", "^dummyJunior$", "^dummyHigh$"), 
  # female, traditional (FofT)
  FofT=c("^Female$", "^dummyJunior.Female$", "^dummyHigh.Female$"),
  # male, other arms (MofN)
  MofN=c("^dummyXX$", "^dummyXX.dummyJunior$", "^dummyXX.dummyHigh$"), 
  # female, other arms (FofN)
  FofN=c("^dummyXX.Female$", "^dummyXX.dummyJunior.Female$", 
    "^dummyXX.dummyHigh.Female$"),
  # male, trad, time (MofTinT)
  MofTinT=c("^Time.YY$", "^dummyJunior.TimeYY$", "^dummyHigh.TimeYY$"), 
  # female, trad, time (FofTinT)
  FofTinT=c("^Female.TimeYY$", "^dummyJunior.Female.TimeYY$", 
   "^dummyHigh.Female.TimeYY$"), 
  # male, other arms, time (MofNinT)
  MofNinT=c("^dummyXX.TimeYY$", "^dummyXX.dummyJunior.TimeYY$", 
  "^dummyXX.dummyHigh.TimeYY$"), 
  # female, other arms, time (FofNinT)
  FofNinT=c("^dummyXX.Female.TimeYY$", 
    "^dummyXX.dummyJunior.Female.TimeYY$", 
    "^dummyXX.dummyHigh.Female.TimeYY$")
  )
FileNames <- c(
  "Schooling", 
  "Land", "Livestock", "NumCows",
  "AssetLivestock", "NetAssets", "NetBroadAssets",
  "NetAssetsAnnualPrices", "NetNLAssets", 
  "NetAssetsExperience", 
  "NumCowsExperience", 
  paste0("NetAssetsByExperience", c("a", "o", "n")),
  paste0("NumCowsByExperience", c("a", "o", "n")),
  "LabourIncome", 
  "Consumption", "ConsumptionOLS")
ListHeaderList <- c(
  "sc", 
  "ld", "lv", "cw", 
  "al", "na", "nb", 
  "np", "nl", # non livestock assets
  "nE", "lE", # net assets by experience, livestock by experience, OwnCow0, AdiCow0
  "nA", "nO", "nN", 
  "lA", "lO", "lN",
  "lb", 
  "cn", "co")
add5 <- c("b", "P", "a", "T", "Ta")
add7 <- c("b", "P", "a", "T", "Ta", "TP", "TPa")
reglists <- list(
  paste0("sc", add5),
  paste0("ld", add7),
  paste0("lv", add5),
  paste0("cw", add7),
  paste0("al", add5),
  paste0("na", add7),
  paste0("nb", add7),
  paste0("np", add7),
  paste0("nl", add7),
  paste0("nE", add7),
  paste0("lE", add7),
  paste0("nA", add7),
  paste0("nO", add7),
  paste0("nN", add7),
  paste0("lA", add5),
  paste0("lO", add5),
  paste0("lN", add5),
  paste0("lb", add7),
  paste0("cn", add7),
  paste0("co", add7)
  )
names(reglists) <- ListHeaderList
gc()
            used   (Mb) gc trigger   (Mb) limit (Mb)  max used   (Mb)
Ncells   2953879  157.8    5622370  300.3         NA   5622370  300.3
Vcells 307913150 2349.2  593298730 4526.6      56320 593298730 4526.6
FNstrings <- "AssetLivestock"
FNames <- FileNames[!grepl(FNstrings, FileNames)]
ListHeaderListForQS <- ListHeaderList[!grepl(FNstrings, FileNames)]
reglists <- reglists[!grepl(FNstrings, FileNames)]
robj <- lapply(1:length(FNames), function(i) 
  qread(paste0(pathsaveHere, "ANCOVA_", FNames[i],".qs")))

Tests for non-schooling outcomes

Click here to see the code to run hypothesis testing.
confi <- linhyp <- NULL
library(car)
library(multcomp)
#### r:
#### 4 (in ListHeaderList, 5) is number of cattle
#### 5 (in ListHeaderList, 6) is net assets
#### 9 (in ListHeaderList, 11) is net non livestock assets
r <- grep("NetAssets$", FNames)
for (r in 2:length(ListHeaderListForQS)) {
  # r: outcomes
  for (rr in 1:length(robj[[r]])) {
    # rr: regression type: "b", "P", "a", "T", "Ta", "PT", "PTa"
    # regobj: e.g., "asT" with s=2,...,7 regression specifications
    regtype <- gsub("^..", "", reglists[[r]][rr])
    if (grepl("a", regtype)) 
      lattributes <- lattributeList[[2]] else
      lattributes <- lattributeList[[1]]
    regobj <- robj[[r]][[rr]]
    if (grepl("cn", ListHeaderListForQS[r])) regobj <- regobj[1:3] # consumption: 4-6 are HH aggregates
    if (grepl("co", ListHeaderListForQS[r])) regobj <- regobj[1:2] # consumptionOLS: 4-5 are HH aggregates
    lmlist <- lapply(regobj, "[[", "lm")
    coefflist <- lapply(lmlist, "[[", "coefficients")
    c(reglists[[r]][rr]) 
    # drop NAs in coeff
    coefflist <- lapply(coefflist, function(x) x[!is.na(x)])
    Vlist <- lapply(lapply(regobj, "[[",  "robust"), "[[", "V")
    # Define covadd (a string vector used to pick coefficients for testing)
    # if regressand is saving:
    #  Change to loan year: TimeX => LYX
    #  Multiply with 12 (turn to monthly to yearly)
    if (any(grepl("sv", reglists[[r]]))) {
      covadd <- covaddsav 
      Mult <- 12
    } else {
      covadd <- covadd0
      Mult <- 1
    }
    covadd.trad <- lapply(covadd, function(x) x[1])
    for (s in 1:length(regobj)) {
      # s: 7 regression specifications
      thisreg <- lmlist[[s]]
      coeffvec <- coefflist[[s]]
      thisV <- Vlist[[s]]
      # Consumption: No rd1 so period= 1, 2. Drop period 3 variables.
      if (grepl("cn", ListHeaderListForQS[r])) startnum <- 2 else startnum <- 1
      # construct conf int for linear combination of coeffs
      #if (grepl("cn", ListHeaderList[r])) addcova <- covadd[-2]
       ## period 2 (=overall, when no Time is present) effects ##
      # trad
      # hvT0: picks covariates to test overall change
      #  [[1]]"\\(Intercept\\)"
      hvT0 <- rep(0, length(coeffvec))
      hvT0[grepl(
           paste0("^", covadd.trad[[1]], "$")
          , names(coeffvec))] <- 1*Mult
      lhcow <- glht(model=thisreg, linfct = matrix(hvT0, byrow = T, nrow=1), 
        alternative="two.sided", vcov.=thisV)
      confi <- rbind(confi, 
         c(FNames[r], regtype, s, "trad", "None", "level of reference trad", "T0", 
         startnum, confint(lhcow)$confint[1, ], 
         if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
         )
      linhyp <- c(linhyp, list(hvT0, thisreg$coeff))
      names(linhyp)[length(linhyp)] <- 
        paste0(c(FNames[r], regtype, s, "trad", "None", "level of reference trad", startnum), collapse = "")
      # nontrad
      for (g in lattributes) {
        # g: attributes or arm
        # construct coefficient names for attribute g (replace XX with g)
        covadd.nontrad <- lapply(covadd, function(x) gsub("XX", g, x))
        # E.g., if g = Large, 
        #  [[1]]
        #  [1] "\\(Intercept\\)" "dummyLarge"     
        #  [[2]]
        #  [1] "Time.3"           "dummyLarge.Time3"
        #  [[3]]
        #  [1] "Time.4"           "dummyLarge.Time4"
        # hvN0: period 2 level for Arm
        #  [[1]]"\\(Intercept\\)", "dummyInKind"
        hvN0 <- rep(0, length(coeffvec))
        hvN0[grepl(
          paste(
            paste0("^", covadd.nontrad[[1]], "$")
           , collapse = "|")
           , names(coeffvec))] <- 1*Mult
        lhcow <- glht(model=thisreg, linfct = matrix(hvN0, byrow = T, nrow=1), 
          alternative="two.sided", vcov.=thisV)
        confi <- rbind(confi, 
          c(FNames[r], regtype, s, g, "None", "level of reference nontrad", "N0", 
           startnum, confint(lhcow)$confint[1, ], 
           if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
          )
        linhyp <- c(linhyp, list(hvN0, thisreg$coeff))
        names(linhyp)[length(linhyp)] <- 
          paste0(c(FNames[r], regtype, s, g, "None", "level of reference nontrad", startnum), collapse = "")
        # hvN1: difference of period 2 Arm relative to period 2 trad
        #  [[1]][2] "dummyInKind"
        cumstrings0 <- peristrings0 <- paste0("^", covadd.nontrad[[1]][2], "$")
        hvN1 <- rep(0, length(coeffvec))
        hvN1[grepl(
            paste0("^", covadd.nontrad[[1]][2], "$")
           , names(coeffvec))] <- 1*Mult
        lhcow <- glht(model=thisreg, linfct = matrix(hvN1, byrow = T, nrow=1), 
          alternative="two.sided", vcov.=thisV)
        confi <- rbind(confi, 
          c(FNames[r], regtype, s, g, "None", "reference nontrad - reference trad", "N1", 
           startnum, confint(lhcow)$confint[1, ], 
           if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
         )
        linhyp <- c(linhyp, list(hvN1, thisreg$coeff))
        names(linhyp)[length(linhyp)] <- 
          paste0(c(FNames[r], regtype, s, g, "None", "reference nontrad - reference trad", 
          startnum), collapse = "")
         ## 2 way (Arm*Time) interactions ##
        if (grepl("T", regtype)) {
          # i: period loop. Start from startnum+1 (=2. Only in consumption, =3.)
          #for (i in (startnum+1):length(covadd.trad)) {
          # i: period loop. Start from startnum (=1. Only in consumption, =2.)
          #  1: Time2 or reference period. 2: Time3, 3: Time4
          for (i in startnum:length(covadd.trad)) {
            # i: period index
            # trad
            # hvTinT: difference = 0 (of trad in time X relative to trad in time 2)
            # [[2]] "Time.4"
            hvTinT <- rep(0, length(coeffvec))
            hvTinT[grepl(
                paste0("^", covadd.trad[[i]], "$")
              , names(coeffvec))] <- 1*Mult
            lhcow <- glht(model=thisreg, linfct = matrix(hvTinT, byrow = T, nrow=1), 
              alternative="two.sided", vcov.=thisV)
            confi <- rbind(confi, 
              c(FNames[r], regtype, s, "trad", "None", "trad in each period - trad in period 2", 
                "TinT", 
                i, confint(lhcow)$confint[1, ], 
                if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
              )
            linhyp <- c(linhyp, list(hvTinT, thisreg$coeff))
            names(linhyp)[length(linhyp)] <- 
              paste0(c(FNames[r], regtype, s, "trad", "None", "trad in each period - trad in period 2", i), collapse = "")
            # hvTL: level = 0 (of trad in TimeX)
            # intercept + Time.X
            hvTL <- hvT0 + hvTinT
            lhcow <- glht(model=thisreg, linfct = matrix(hvTL, byrow = T, nrow=1), 
              alternative="two.sided", vcov.=thisV)
            confi <- rbind(confi, 
              c(FNames[r], regtype, s, "trad", "None", "level of trad in period X", 
                "TL", 
                i, confint(lhcow)$confint[1, ], 
                if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
            linhyp <- c(linhyp, list(hvTL, thisreg$coeff))
            names(linhyp)[length(linhyp)] <- 
              paste0(c(FNames[r], regtype, s, "trad", "None", "level of trad in period X", i), collapse = "")
            # nontrad
            # hvNinT: difference = 0 (of arm g in time X relative to arm g at period 2)
            #   intercept + Arm +TimeX + Arm.TimeX - (intercept + Arm) 
            #   = TimeX + Arm.TimeX
            # [[2]] "Time.4", "dummyInKind.Time4"
            # For period 2, it gives period 2 level of Arm. 
            hvNinT <- rep(0, length(coeffvec))
            hvNinT[grepl(
              paste(
                paste0("^", covadd.nontrad[[i]], "$")
              , collapse = "|")
              , names(coeffvec))] <- 1*Mult
            lhcow <- glht(model=thisreg, linfct = matrix(hvNinT, byrow = T, nrow=1), 
              alternative="two.sided", vcov.=thisV)
            confi <- rbind(confi, 
              c(FNames[r], regtype, s, g, "None", "nontrad in each period - nontrad in period 2", 
               "NinT", 
                i, confint(lhcow)$confint[1, ], 
                if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
              )
            linhyp <- c(linhyp, list(hvNinT, thisreg$coeff))
            names(linhyp)[length(linhyp)] <- 
              paste0(c(FNames[r], regtype, s, g, "None", "nontrad in each period - nontrad in period 2", i), collapse = "")
            # dhvNinT: Difference = 0 (of Arm g relative to trad, in time X)
            # Marginal difference between g and trad in time X.
            # [[2]][1] "dummyInKind.Time4"
            dhvNinT <- rep(0, length(coeffvec))
            dhvNinT[grepl(
                paste0("^", covadd.nontrad[[i]][2], "$")
              , names(coeffvec))] <- 1*Mult
            lhcow <- glht(model=thisreg, linfct = matrix(dhvNinT, byrow = T, nrow=1), 
              alternative="two.sided", vcov.=thisV)
            confi <- rbind(confi, 
              c(FNames[r], regtype, s, g, "None", "nontrad - trad, in each period", 
                "dNinT", 
                i, confint(lhcow)$confint[1, ], 
                if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
              )
            linhyp <- c(linhyp, list(dhvNinT, thisreg$coeff))
            names(linhyp)[length(linhyp)] <- 
              paste0(c(FNames[r], regtype, s, g, "None", "nontrad - trad in each period", i), collapse = "")
            # hvNinT2: difference = 0 (of arm g in time X relative to trad in time 2)
            #   intercept + Arm +TimeX + Arm.TimeX - (intercept) 
            #   = Arm + TimeX + Arm.TimeX 
            #   = hvN1 + hvNinT
            # [[2]] "dummyInKind", "Time.4", "dummyInKind.Time4"
            hvNinT2 <- hvN1 + hvNinT
            lhcow <- glht(model=thisreg, linfct = matrix(hvNinT2, byrow = T, nrow=1), 
              alternative="two.sided", vcov.=thisV)
            confi <- rbind(confi, 
              c(FNames[r], regtype, s, g, "None", "nontrad in each period - trad in period 2", 
               "NinT2", 
                i, confint(lhcow)$confint[1, ], 
                if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
              )
            linhyp <- c(linhyp, list(hvNinT2, thisreg$coeff))
            names(linhyp)[length(linhyp)] <- 
              paste0(c(FNames[r], regtype, s, g, "None", "nontrad in each period - trad in period 2", i), collapse = "")
            # periNrelativeT: Cumulative difference = 0 (of nontrad Arm g relative to trad, in time i)
            # Total difference between g and trad in time X.
            #  "dummyInKind"+"dummyInKind.TimeX" for cumulative effects relative to trad in time X
            # "dummyInKind" is stored in peristrings0 at hvN1
            periNrelativeT <- rep(0, length(coeffvec))
            peristrings2 <- paste(peristrings0, paste0("^", covadd.nontrad[[i]][2], "$"), sep = "|")
            periNrelativeT[grepl(peristrings2, names(coeffvec))] <- 1*Mult
            lhcow <- glht(model=thisreg, linfct = matrix(periNrelativeT, byrow = T, nrow=1), 
              alternative="two.sided", vcov.=thisV)
            confi <- rbind(confi, 
              c(FNames[r], regtype, s, g, "None", "sum of (nontrad - trad, in each period)", 
                "periNrelativeT", 
                i, confint(lhcow)$confint[1, ], 
                if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
              )
            linhyp <- c(linhyp, list(periNrelativeT, thisreg$coeff))
            names(linhyp)[length(linhyp)] <- 
              paste0(c(FNames[r], regtype, s, g, "None", 
              "sum of nontrad - trad in each period", i), collapse = "")
            # hvN2: level = 0 (of nontrad in period t)
            # = cumulative trad + relative to concurrent trad
            # Intercept+TimeX+Arm+TimeX.Arm=hvT0 + hvNinT
            hvN2 <- hvT0 + hvNinT
            lhcow <- glht(model=thisreg, linfct = matrix(hvN2, byrow = T, nrow=1), 
              alternative="two.sided", vcov.=thisV)
            confi <- rbind(confi, 
              c(FNames[r], regtype, s, g, "None", "level of nontrad in each period", 
              "N2", 
                i, confint(lhcow)$confint[1, ], 
                if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
              )
            linhyp <- c(linhyp, list(hvN2, thisreg$coeff))
            names(linhyp)[length(linhyp)] <- 
              paste0(c(FNames[r], regtype, s, g, "None", "level of nontrad in each period", i), collapse = "")
            ## 3 way (OwnCattle0*Arm*Time) interactions ##
            # Loop over OwnCattle0, AdiCattle0, 
            if (grepl("sExpe", FNames[r])) {
              for (j in paste0("dummy", c("Own", "Adi"), "Cattle0")) {
              # j: experience type
                # dhvJ0: Difference between j and trad at period 2
                #  dummyAdiCattle0
                # dhvJG0: Difference between j and arm/attribute g at period 2
                #  dummyAdiCattle0.Large
                # dhvJinT: Difference between j and concurrent trad in period X.
                #  dummyAdiCattle0.TimeX
                # dhvJGinT: Difference between j*g and g in X
                #  dummyAdiCattle0.Large.TimeX
                # hvJinT: Cumulative difference between j and concurrent trad in period X.
                #  dummyAdiCattle0 + dummyAdiCattle0.TimeX
                # hvJGinT: Cumulative difference between j*g and g in T
                #  dummyAdiCattle0.Large + dummyAdiCattle0.Large.TimeX
                # periJGinT: Cumulative difference between j*g and concurrent trad in time X.
                #  dummyLarge + dummyLarge.TimeX : periNrelativeT
                # +dummyAdiCattle0 + dummyAdiCattle0.TimeX : hvJinT
                # +dummyAdiCows0.Large+dummyAdiCows0.Large.TimeX : hvJGinT

                # dhvJ0: dummyAdiCattle0
                # Difference between j and trad at period 2
                 dhvJ0 <- rep(0, length(coeffvec))
                 dhvJ0[grepl(
                     paste0("^", j, "$")
                   , names(coeffvec))] <- 1*Mult
                 lhcow <- glht(model=thisreg, linfct = matrix(dhvJ0, byrow = T, nrow=1), 
                   alternative="two.sided", vcov.=thisV)
                 confi <- rbind(confi, 
                   c(FNames[r], regtype, s, g, j, "j*g - trad, in period 2", 
                     "dJ0", 
                     i, confint(lhcow)$confint[1, ], 
                     if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
                   )
                 linhyp <- c(linhyp, list(dhvJ0, thisreg$coeff))
                 names(linhyp)[length(linhyp)] <- 
                   paste0(c(FNames[r], regtype, s, g, j, "jg - trad in period 2", i), collapse = "")
                # dhvJinT: dummyAdiCattle0.TimeX
                # dhvJinT: Difference between j and concurrent trad in period X.
                 dhvJinT <- rep(0, length(coeffvec))
                 dhvJinT[grepl(
                     paste0("^", j, ".Time.$")
                   , names(coeffvec))] <- 1*Mult
                 lhcow <- glht(model=thisreg, linfct = matrix(dhvJinT, byrow = T, nrow=1), 
                   alternative="two.sided", vcov.=thisV)
                 confi <- rbind(confi, 
                   c(FNames[r], regtype, s, g, j, "j - trad, in each period", 
                     "dJinT", 
                     i, confint(lhcow)$confint[1, ], 
                     if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
                   )
                 linhyp <- c(linhyp, list(dhvJinT, thisreg$coeff))
                 names(linhyp)[length(linhyp)] <- 
                   paste0(c(FNames[r], regtype, s, g, j, "j - trad in each period", i), collapse = "")
                # hvJinT: Total difference between j and concurrent trad in period T.
                #  dummyAdiCattle0 + dummyAdiCattle0.TimeX
                 hvJinT <- dhvJ0+dhvJinT
                # hvJG0: dummyAdiCattle0.Large
                 hvJG0 <- rep(0, length(coeffvec))
                 hvJG0[grepl(
                     paste0("^", j, "$")
                   , names(coeffvec))] <- 1*Mult
                # dhvJGinT: dummyAdiCattle0.Large.TimeX
                 dhvJGinT <- rep(0, length(coeffvec))
                 dhvJGinT[grepl(
                     paste0("^", j, ".", covadd.nontrad[[i]][2])
                   , names(coeffvec))] <- 1*Mult
                # hvJGinT: dummyAdiCattle0.Large + dummyAdiCattle0.Large.TimeX
                 hvJGinT <- hvJG0 + dhvJGinT
                 lhcow <- glht(model=thisreg, linfct = matrix(hvJGinT, byrow = T, nrow=1), 
                   alternative="two.sided", vcov.=thisV)
                 confi <- rbind(confi, 
                   c(FNames[r], regtype, s, g, j, "j*g - g, in each period", 
                     "JGinT", 
                     i, confint(lhcow)$confint[1, ], 
                     if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
                   )
                 linhyp <- c(linhyp, list(hvJGinT, thisreg$coeff))
                 names(linhyp)[length(linhyp)] <- 
                   paste0(c(FNames[r], regtype, s, g, j,
                     "RelativeToConcurrentArmAttribute", i), collapse = "")
                # periJGinT: Cumulative difference between j*g and concurrent trad in time X.
                #  dummyLarge + dummyLarge.TimeX : periNrelativeT
                # +dummyAdiCattle0 + dummyAdiCattle0.TimeX : hvJinT
                # +dummyAdiCows0.Large+dummyAdiCows0.Large.TimeX : hvJGinT
                periJGinT <- periNrelativeT+hvJinT+hvJGinT
                lhcow <- glht(model=thisreg, linfct = matrix(periJGinT, byrow = T, nrow=1), 
                  alternative="two.sided", vcov.=thisV)
                confi <- rbind(confi, 
                  c(FNames[r], regtype, s, g, j, "j*g - trad, in each period", 
                    "periJGinT", 
                     i, confint(lhcow)$confint[1, ], 
                     if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
                  )
                linhyp <- c(linhyp, list(periNrelativeT, thisreg$coeff))
                names(linhyp)[length(linhyp)] <- 
                  paste0(c(FNames[r], regtype, s, g, j, "jg - trad in each period", i), collapse = "")
              } # end: cattle experience (Own/Adi) j loop
            } # end: if "sExperience in FileName[r]" loop
            ### Some outcomes do not have dummyUltraPoor as a level covariate. Need to fix it.
            ### Before doing so, abort these outcomes.
            if (grepl("Exper", FNames[r])) next
            if (grepl("Pa?$", reglists[[r]][rr])) {
              # if time-invariant poverty wise impacts are estimated
              # matP
              # Poor = 0 for trad
              # Poor + Arm.Poor = 0 for nontrad
              # covadd.trad
              # [[1]][1] "\\(Intercept\\)" ==> dummyUltraPoor
              # [[2]][1] "Time.3" ==> dummyUltraPoor.Time3
              # [[3]][1] "Time.4" ==> dummyUltraPoor.Time4
              # trad
              covadd.tradP <- lapply(covadd.trad, 
                function(x) gsub(".*ntercept.*", "dummyUltraPoor", x))
              covadd.tradP <- lapply(covadd.tradP, 
                function(x) gsub("T", "dummyUltraPoor.T", x))
              covadd.tradP <- lapply(covadd.tradP, 
                function(x) gsub("Time\\.", "Time", x))
              matPT <- rep(0, length(coeffvec))
              matPT[grepl(
                paste0("^", covadd.tradP[[1]], "$")
              , names(coeffvec))] <- 1*Mult
              # dummyInKind.Time4 ==> dummyInKind.UltraPoor.Time4
              covadd.nontradP <- lapply(covadd.nontrad, 
                function(x) gsub("T", "UltraPoor.T", x[2]))
              # nontrad 
              matPN <- rep(0, length(coeffvec))
              matPN[grepl(
                  paste0("^", covadd.nontradP[[i]], "$")
                , names(coeffvec))] <- 1*Mult
              matP <- rbind(matPT, matPN=matPT+matPN)
              lhcow <- glht(model=thisreg, linfct = matP, 
                alternative="two.sided", vcov.=thisV)
              confi <- rbind(confi, 
                c(FNames[r], regtype, s, g, "poor", "Poor + Arm.Poor = 0, time invariant", 
                  "matP", 
                   "2-4", confint(lhcow)$confint[1, ], 
                   if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA),
                c(FNames[r], regtype, s, g, "poor + arm*poor", "Poor + Arm.Poor = 0, time invariant", 
                  "matP", 
                   "2-4", confint(lhcow)$confint[2, ], 
                   if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[2] else NA)
               )
            } # end: if time-invariant poverty wise impacts are estimated
            if (grepl("TPa?$", reglists[[r]][rr])) {
              # if time-variant poverty wise impacts are estimated
              # dmatPTinT
              # Time = 2: Poor = 0; Time = 3: Poor.Time3 = 0  for trad
              # dmatPNinT
              # Time = 2: Arm.Poor = 0; Time = 3: Arm.Poor.Time3 = 0 for nontrad
              # TimeYY ==> dummyUltraPoor.TimeYY
              covadd.tradP <- lapply(covadd.trad, 
                function(x) gsub(".*ntercept.*", "dummyUltraPoor", x))
              covadd.tradP <- lapply(covadd.tradP, 
                function(x) gsub("T", "dummyUltraPoor.T", x))
              covadd.tradP <- lapply(covadd.tradP, 
                function(x) gsub("Time\\.", "Time", x))
              dmatPTinT <- rep(0, length(coeffvec))
              dmatPTinT[grepl(
                paste0("^", covadd.tradP[[i]], "$")
              , names(coeffvec))] <- 1*Mult
              # dummyInKind.Time4 ==> dummyInKind.UltraPoor.Time4
              covadd.nontradP <- lapply(covadd.nontrad, 
                function(x) gsub("T", "UltraPoor.T", x[2]))
              # nontrad 
              dmatPNinT <- rep(0, length(coeffvec))
              dmatPNinT[grepl(
                  paste0("^", covadd.nontradP[[i]], "$")
                , names(coeffvec))] <- 1*Mult
              # matPTinT: sum of (poor trad - nonpoor trad, in each period)
              # Time = 2: Poor = 0; Time = 3: Poor + Poor.Time3 = 0  for trad
              #   = matP + dmatPTinT
              # matPNinT: sum of (poor nontrad - nonpoor nontrad, in each period)
              # Time = 2: Poor + Arm.Poor = 0; Time = 3: Poor + Arm.Poor + Arm.Poor.Time3 = 0 for nontrad
              #   = matPTinT + dmatPNinT
              # Poor = 0 for trad
              matP <- rep(0, length(coeffvec))
              matP[grep("^dummyUltraPoor$", names(coeffvec))] <- 1*Mult
              matPTinT <- matP + dmatPTinT
              matPNinT <- matPTinT + dmatPNinT
              lhcow1 <- glht(model=thisreg, linfct = t(matrix(dmatPTinT)),
                alternative="two.sided", vcov.=thisV)
              lhcow2 <- glht(model=thisreg, linfct = t(matrix(dmatPNinT)),
                alternative="two.sided", vcov.=thisV)
              lhcow3 <- glht(model=thisreg, linfct = t(matrix(matPTinT)),
                alternative="two.sided", vcov.=thisV)
              lhcow4 <- glht(model=thisreg, linfct = t(matrix(matPNinT)),
                alternative="two.sided", vcov.=thisV)
              confi <- rbind(confi, 
                c(FNames[r], regtype, s, g, "dpoor.TimeX", 
                  "poor trad - nonpoor trad, in each period", "dmatPTinT", 
                   i, confint(lhcow1)$confint[1, ], 
                   if (sum(lhcow1$linfct) != 0) summary(lhcow1)$test$pvalues[1] else NA),
                c(FNames[r], regtype, s, g, "dpoor.Arm.TimeX", 
                  "poor nontrad - nonpoor nontrad, in each period", "dmatPNinT", 
                   i, confint(lhcow2)$confint[1, ], 
                   if (sum(lhcow2$linfct) != 0) summary(lhcow2)$test$pvalues[1] else NA),
                c(FNames[r], regtype, s, g, "poor.TimeX", 
                  "sum of (poor trad - nonpoor trad, in each period)", "matPTinT", 
                   i, confint(lhcow3)$confint[1, ], 
                   if (sum(lhcow3$linfct) != 0) summary(lhcow3)$test$pvalues[1] else NA),
                c(FNames[r], regtype, s, g, "poor.Arm.TimeX", 
                  "sum of (poor nontrad - nonpoor nontrad, in each period)", "matPNinT", 
                   i, confint(lhcow4)$confint[1, ], 
                   if (sum(lhcow4$linfct) != 0) summary(lhcow4)$test$pvalues[1] else NA)
               )
            } # end: if time-variant poverty wise impacts are estimated
          } # end: period i loop
        } # end: if "T in regtype" loop
      } # end: attribute g loop
    } # end: reg specification s loop 2:7
  } # end: reg type rr loop ("", "P", "a", "T", "Ta", ...)
} # end: outcome r loop
confi <- data.table(unique(confi))
setnames(confi, c("FileName", "regtype", "num", "attributes", "experience",
  "ImpactType", "hv", "period", "estimate", "lb", "ub", "pvalue"))
numcols <- c("period", "estimate", "lb", "ub", "num", "pvalue")
confi[, (numcols) := lapply(.SD, as.numeric), .SDcols = numcols]
faccols <- c("FileName", "regtype", "attributes", "experience", "hv", "ImpactType")
confi[, (faccols) := lapply(.SD, as.factor), .SDcols = faccols]
#### Drop all num == 1 except for ConsumptionOLS, 
#### NumCows and NumCowsAdi, NumCowsNone, NumCowsOwn, 
confi <- confi[grepl("NumCows|OLS", FileName) | (!grepl("NumCows", FileName) & num != 1), ]
confi <- confi[!(grepl("NumCowsE", FileName) & num == 1), ]
table(confi[, .(FileName, num)])
                        num
FileName                   1   2   3   4   5   6
  Consumption              0 257 257   0   0   0
  ConsumptionOLS         361 361   0   0   0   0
  LabourIncome             0 361 361 361 361 361
  Land                     0 361 361 361 361 361
  Livestock                0 137 137 137   0   0
  NetAssets                0 361 361 361 361 361
  NetAssetsAnnualPrices    0 361 361 361 361 361
  NetAssetsByExperiencea   0 253 253 253   0   0
  NetAssetsByExperiencen   0 253 253 253   0   0
  NetAssetsByExperienceo   0 253 253 253   0   0
  NetAssetsExperience      0 541 541 541 541   0
  NetBroadAssets           0 355 355 355 355 355
  NetNLAssets              0 361 361 361 361 361
  NumCows                361 361 361 361   0   0
  NumCowsByExperiencea   137 137 137   0   0   0
  NumCowsByExperiencen   137 137 137   0   0   0
  NumCowsByExperienceo   137 137 137   0   0   0
  NumCowsExperience        0 541 541 541 541   0
confi[, ImpactType := factor(ImpactType, 
  levels = c(
    "level of reference trad",
    "level of trad in period X",
    "level of reference nontrad",
    "level of nontrad in each period",
    "reference nontrad - reference trad",
    "trad in each period - trad in period 2",
    "nontrad in each period - trad in period 2",
    "nontrad in each period - nontrad in period 2",
    "nontrad - trad, in each period",
    "sum of (nontrad - trad, in each period)",
    "j - trad, in each period",
    "j*g - trad, in period 2",
    "j*g - trad, in each period",
    "j*g - g, in each period",
    "Poor + Arm.Poor = 0, time invariant",
    "poor trad - nonpoor trad, in each period",
    "poor nontrad - nonpoor nontrad, in each period",
    "sum of (poor trad - nonpoor trad, in each period)",
    "sum of (poor nontrad - nonpoor nontrad, in each period)"
  ))]
confi[, ImpactType := factor(ImpactType, 
  labels = c(
    "level of reference trad",
    "level of trad in each period",
    "level of reference nontrad",
    "level of nontrad in each period",
    "reference nontrad - reference trad",
    "trad in each period - trad in period 2",
    "nontrad in each period - trad in period 2",
    "nontrad in each period - nontrad in period 2",
    "nontrad - trad, in each period",
    "sum of (nontrad - trad, in each period)",
    "j - trad, in each period",
    "j*g - trad in period 2",
    "j*g - trad, in each period",
    "j*g - g, in each period",
    "poor - nonpoor, in all arms, time invariant",
    "poor trad - nonpoor trad, in each period",
    "poor nontrad - nonpoor nontrad, in each period",
    "sum of (poor trad - nonpoor trad, in each period)",
    "sum of (poor nontrad - nonpoor nontrad, in each period)"
))]


confi[grepl("Con.*OL", FileName) & regtype=="T" & grepl("ge$", attributes) & grepl("sum", ImpactType), ]
         FileName regtype   num attributes experience                              ImpactType
           <fctr>  <fctr> <num>     <fctr>     <fctr>                                  <fctr>
1: ConsumptionOLS       T     1      Large       None sum of (nontrad - trad, in each period)
2: ConsumptionOLS       T     1      Large       None sum of (nontrad - trad, in each period)
3: ConsumptionOLS       T     1      Large       None sum of (nontrad - trad, in each period)
4: ConsumptionOLS       T     2      Large       None sum of (nontrad - trad, in each period)
5: ConsumptionOLS       T     2      Large       None sum of (nontrad - trad, in each period)
6: ConsumptionOLS       T     2      Large       None sum of (nontrad - trad, in each period)
               hv period  estimate         lb       ub    pvalue
           <fctr>  <num>     <num>      <num>    <num>     <num>
1: periNrelativeT      1 -24.82061 -154.22274 104.5815 0.7068970
2: periNrelativeT      2 106.74113 -165.72779 379.2101 0.4424986
3: periNrelativeT      3  99.48224  -94.92933 293.8938 0.3158087
4: periNrelativeT      1  30.03860  -93.35580 153.4330 0.6331967
5: periNrelativeT      2 152.92079 -116.60017 422.4417 0.2660418
6: periNrelativeT      3 134.16950  -46.78632 315.1253 0.1461213
confi[, period := period + 1]
#### period is NA for non-timevarying regressions
confi[!grepl("T", regtype), period := NA]
confi[!is.na(period) & grepl("Con", FileName) & num == 2 & grepl("Ta", regtype), ][
order(attributes, ImpactType, period)]
          FileName regtype   num attributes experience                                   ImpactType
            <fctr>  <fctr> <num>     <fctr>     <fctr>                                       <fctr>
 1: ConsumptionOLS      Ta     2     InKind       None                   level of reference nontrad
 2:    Consumption      Ta     2     InKind       None                   level of reference nontrad
 3: ConsumptionOLS      Ta     2     InKind       None              level of nontrad in each period
 4:    Consumption      Ta     2     InKind       None              level of nontrad in each period
 5: ConsumptionOLS      Ta     2     InKind       None              level of nontrad in each period
 6:    Consumption      Ta     2     InKind       None              level of nontrad in each period
 7: ConsumptionOLS      Ta     2     InKind       None              level of nontrad in each period
 8: ConsumptionOLS      Ta     2     InKind       None           reference nontrad - reference trad
 9:    Consumption      Ta     2     InKind       None           reference nontrad - reference trad
10: ConsumptionOLS      Ta     2     InKind       None    nontrad in each period - trad in period 2
11:    Consumption      Ta     2     InKind       None    nontrad in each period - trad in period 2
12: ConsumptionOLS      Ta     2     InKind       None    nontrad in each period - trad in period 2
13:    Consumption      Ta     2     InKind       None    nontrad in each period - trad in period 2
14: ConsumptionOLS      Ta     2     InKind       None    nontrad in each period - trad in period 2
15: ConsumptionOLS      Ta     2     InKind       None nontrad in each period - nontrad in period 2
16:    Consumption      Ta     2     InKind       None nontrad in each period - nontrad in period 2
17: ConsumptionOLS      Ta     2     InKind       None nontrad in each period - nontrad in period 2
18:    Consumption      Ta     2     InKind       None nontrad in each period - nontrad in period 2
19: ConsumptionOLS      Ta     2     InKind       None nontrad in each period - nontrad in period 2
20: ConsumptionOLS      Ta     2     InKind       None               nontrad - trad, in each period
21:    Consumption      Ta     2     InKind       None               nontrad - trad, in each period
22: ConsumptionOLS      Ta     2     InKind       None               nontrad - trad, in each period
23:    Consumption      Ta     2     InKind       None               nontrad - trad, in each period
24: ConsumptionOLS      Ta     2     InKind       None               nontrad - trad, in each period
25: ConsumptionOLS      Ta     2     InKind       None      sum of (nontrad - trad, in each period)
26:    Consumption      Ta     2     InKind       None      sum of (nontrad - trad, in each period)
27: ConsumptionOLS      Ta     2     InKind       None      sum of (nontrad - trad, in each period)
28:    Consumption      Ta     2     InKind       None      sum of (nontrad - trad, in each period)
29: ConsumptionOLS      Ta     2     InKind       None      sum of (nontrad - trad, in each period)
30: ConsumptionOLS      Ta     2  LargeSize       None                   level of reference nontrad
31:    Consumption      Ta     2  LargeSize       None                   level of reference nontrad
32: ConsumptionOLS      Ta     2  LargeSize       None              level of nontrad in each period
33:    Consumption      Ta     2  LargeSize       None              level of nontrad in each period
34: ConsumptionOLS      Ta     2  LargeSize       None              level of nontrad in each period
35:    Consumption      Ta     2  LargeSize       None              level of nontrad in each period
36: ConsumptionOLS      Ta     2  LargeSize       None              level of nontrad in each period
37: ConsumptionOLS      Ta     2  LargeSize       None           reference nontrad - reference trad
38:    Consumption      Ta     2  LargeSize       None           reference nontrad - reference trad
39: ConsumptionOLS      Ta     2  LargeSize       None    nontrad in each period - trad in period 2
40:    Consumption      Ta     2  LargeSize       None    nontrad in each period - trad in period 2
41: ConsumptionOLS      Ta     2  LargeSize       None    nontrad in each period - trad in period 2
42:    Consumption      Ta     2  LargeSize       None    nontrad in each period - trad in period 2
43: ConsumptionOLS      Ta     2  LargeSize       None    nontrad in each period - trad in period 2
44: ConsumptionOLS      Ta     2  LargeSize       None nontrad in each period - nontrad in period 2
45:    Consumption      Ta     2  LargeSize       None nontrad in each period - nontrad in period 2
46: ConsumptionOLS      Ta     2  LargeSize       None nontrad in each period - nontrad in period 2
47:    Consumption      Ta     2  LargeSize       None nontrad in each period - nontrad in period 2
48: ConsumptionOLS      Ta     2  LargeSize       None nontrad in each period - nontrad in period 2
49: ConsumptionOLS      Ta     2  LargeSize       None               nontrad - trad, in each period
50:    Consumption      Ta     2  LargeSize       None               nontrad - trad, in each period
51: ConsumptionOLS      Ta     2  LargeSize       None               nontrad - trad, in each period
52:    Consumption      Ta     2  LargeSize       None               nontrad - trad, in each period
53: ConsumptionOLS      Ta     2  LargeSize       None               nontrad - trad, in each period
54: ConsumptionOLS      Ta     2  LargeSize       None      sum of (nontrad - trad, in each period)
55:    Consumption      Ta     2  LargeSize       None      sum of (nontrad - trad, in each period)
56: ConsumptionOLS      Ta     2  LargeSize       None      sum of (nontrad - trad, in each period)
57:    Consumption      Ta     2  LargeSize       None      sum of (nontrad - trad, in each period)
58: ConsumptionOLS      Ta     2  LargeSize       None      sum of (nontrad - trad, in each period)
59: ConsumptionOLS      Ta     2       trad       None                      level of reference trad
60:    Consumption      Ta     2       trad       None                      level of reference trad
61: ConsumptionOLS      Ta     2       trad       None                 level of trad in each period
62:    Consumption      Ta     2       trad       None                 level of trad in each period
63: ConsumptionOLS      Ta     2       trad       None                 level of trad in each period
64:    Consumption      Ta     2       trad       None                 level of trad in each period
65: ConsumptionOLS      Ta     2       trad       None                 level of trad in each period
66: ConsumptionOLS      Ta     2       trad       None       trad in each period - trad in period 2
67:    Consumption      Ta     2       trad       None       trad in each period - trad in period 2
68: ConsumptionOLS      Ta     2       trad       None       trad in each period - trad in period 2
69:    Consumption      Ta     2       trad       None       trad in each period - trad in period 2
70: ConsumptionOLS      Ta     2       trad       None       trad in each period - trad in period 2
71: ConsumptionOLS      Ta     2  WithGrace       None                   level of reference nontrad
72:    Consumption      Ta     2  WithGrace       None                   level of reference nontrad
73: ConsumptionOLS      Ta     2  WithGrace       None              level of nontrad in each period
74:    Consumption      Ta     2  WithGrace       None              level of nontrad in each period
75: ConsumptionOLS      Ta     2  WithGrace       None              level of nontrad in each period
76:    Consumption      Ta     2  WithGrace       None              level of nontrad in each period
77: ConsumptionOLS      Ta     2  WithGrace       None              level of nontrad in each period
78: ConsumptionOLS      Ta     2  WithGrace       None           reference nontrad - reference trad
79:    Consumption      Ta     2  WithGrace       None           reference nontrad - reference trad
80: ConsumptionOLS      Ta     2  WithGrace       None    nontrad in each period - trad in period 2
81:    Consumption      Ta     2  WithGrace       None    nontrad in each period - trad in period 2
82: ConsumptionOLS      Ta     2  WithGrace       None    nontrad in each period - trad in period 2
83:    Consumption      Ta     2  WithGrace       None    nontrad in each period - trad in period 2
84: ConsumptionOLS      Ta     2  WithGrace       None    nontrad in each period - trad in period 2
85: ConsumptionOLS      Ta     2  WithGrace       None nontrad in each period - nontrad in period 2
86:    Consumption      Ta     2  WithGrace       None nontrad in each period - nontrad in period 2
87: ConsumptionOLS      Ta     2  WithGrace       None nontrad in each period - nontrad in period 2
88:    Consumption      Ta     2  WithGrace       None nontrad in each period - nontrad in period 2
89: ConsumptionOLS      Ta     2  WithGrace       None nontrad in each period - nontrad in period 2
90: ConsumptionOLS      Ta     2  WithGrace       None               nontrad - trad, in each period
91:    Consumption      Ta     2  WithGrace       None               nontrad - trad, in each period
92: ConsumptionOLS      Ta     2  WithGrace       None               nontrad - trad, in each period
93:    Consumption      Ta     2  WithGrace       None               nontrad - trad, in each period
94: ConsumptionOLS      Ta     2  WithGrace       None               nontrad - trad, in each period
95: ConsumptionOLS      Ta     2  WithGrace       None      sum of (nontrad - trad, in each period)
96:    Consumption      Ta     2  WithGrace       None      sum of (nontrad - trad, in each period)
97: ConsumptionOLS      Ta     2  WithGrace       None      sum of (nontrad - trad, in each period)
98:    Consumption      Ta     2  WithGrace       None      sum of (nontrad - trad, in each period)
99: ConsumptionOLS      Ta     2  WithGrace       None      sum of (nontrad - trad, in each period)
          FileName regtype   num attributes experience                                   ImpactType
                hv period    estimate          lb          ub       pvalue
            <fctr>  <num>       <num>       <num>       <num>        <num>
 1:             N0      2 3152.550510 2931.123285 3373.977735 0.000000e+00
 2:             N0      3 2125.832613 1844.526334 2407.138892 0.000000e+00
 3:             N2      2 6331.890349 5964.051665 6699.729033 0.000000e+00
 4:             N2      3 2032.457507 1802.789242 2262.125772 0.000000e+00
 5:             N2      3 3956.030846 3713.845566 4198.216126 0.000000e+00
 6:             N2      4 1942.826339 1636.562773 2249.089905 0.000000e+00
 7:             N2      4 3849.251194 3653.493787 4045.008601 0.000000e+00
 8:             N1      2  -26.789329 -152.180206   98.601549 6.753368e-01
 9:             N1      3   93.375106  -47.910650  234.660861 1.950306e-01
10:          NinT2      2 3125.761181 2804.791234 3446.731128 0.000000e+00
11:          NinT2      3   93.375106  -47.910650  234.660861 1.950306e-01
12:          NinT2      3  749.901678  507.840020  991.963336 1.365170e-09
13:          NinT2      4    3.743938 -182.970277  190.458153 9.686289e-01
14:          NinT2      4  643.122026  496.637022  789.607031 0.000000e+00
15:           NinT      2 3152.550510 2931.123285 3373.977735 0.000000e+00
16:           NinT      3    0.000000    0.000000    0.000000           NA
17:           NinT      3  776.691007  573.381168  980.000846 8.437695e-14
18:           NinT      4  -89.631168 -340.816822  161.554485 4.840494e-01
19:           NinT      4  669.911355  506.369083  833.453626 1.332268e-15
20:          dNinT      2  -26.789329 -152.180206   98.601549 6.753368e-01
21:          dNinT      3    0.000000    0.000000    0.000000           NA
22:          dNinT      3  224.385736   33.391577  415.379896 2.131170e-02
23:          dNinT      4 -181.553845 -438.709134   75.601444 1.662863e-01
24:          dNinT      4   10.874220 -152.101620  173.850060 8.959291e-01
25: periNrelativeT      2  -26.789329 -152.180206   98.601549 6.753368e-01
26: periNrelativeT      3   93.375106  -47.910650  234.660861 1.950306e-01
27: periNrelativeT      3  197.596407  -37.902477  433.095292 1.000456e-01
28: periNrelativeT      4  -88.178740 -275.042934   98.685455 3.547669e-01
29: periNrelativeT      4  -15.915108 -149.052642  117.222425 8.147156e-01
30:             N0      2 3209.378439 3034.882693 3383.874185 0.000000e+00
31:             N0      3 2093.602427 1855.303966 2331.900888 0.000000e+00
32:             N2      2 6388.718278 6074.649031 6702.787524 0.000000e+00
33:             N2      3 2032.457507 1802.789242 2262.125772 0.000000e+00
34:             N2      3 3854.527297 3577.881050 4131.173543 0.000000e+00
35:             N2      4 2148.462843 1827.598267 2469.327419 0.000000e+00
36:             N2      4 3942.507871 3683.509198 4201.506543 0.000000e+00
37:             N1      2   30.038600  -93.355796  153.432996 6.331967e-01
38:             N1      3   61.144920  -79.712926  202.002766 3.946129e-01
39:          NinT2      2 3239.417039 2984.729357 3494.104721 0.000000e+00
40:          NinT2      3   61.144920  -79.712926  202.002766 3.946129e-01
41:          NinT2      3  705.226058  412.768320  997.683796 2.349174e-06
42:          NinT2      4  177.150256  -20.077172  374.377684 7.829214e-02
43:          NinT2      4  793.206632  594.011722  992.401542 7.438494e-15
44:           NinT      2 3209.378439 3034.882693 3383.874185 0.000000e+00
45:           NinT      3    0.000000    0.000000    0.000000           NA
46:           NinT      3  675.187458  435.696008  914.678908 3.457845e-08
47:           NinT      4  116.005336 -115.217017  347.227689 3.251959e-01
48:           NinT      4  763.168032  564.946414  961.389649 5.417888e-14
49:          dNinT      2   30.038600  -93.355796  153.432996 6.331967e-01
50:          dNinT      3    0.000000    0.000000    0.000000           NA
51:          dNinT      3  122.882187  -89.346660  335.111034 2.563692e-01
52:          dNinT      4   24.082659 -186.094889  234.260206 8.221876e-01
53:          dNinT      4  104.130897  -70.492359  278.754154 2.424277e-01
54: periNrelativeT      2   30.038600  -93.355796  153.432996 6.331967e-01
55: periNrelativeT      3   61.144920  -79.712926  202.002766 3.946129e-01
56: periNrelativeT      3  152.920787 -116.600175  422.441749 2.660418e-01
57: periNrelativeT      4   85.227578  -90.642826  261.097983 3.419525e-01
58: periNrelativeT      4  134.169498  -46.786322  315.125317 1.461213e-01
59:             T0      2 3179.339839 3016.600572 3342.079106 0.000000e+00
60:             T0      3 2032.457507 1802.789242 2262.125772 0.000000e+00
61:             TL      2 6358.679677 6033.201144 6684.158211 0.000000e+00
62:             TL      3 2032.457507 1802.789242 2262.125772 0.000000e+00
63:             TL      3 3731.645110 3561.366843 3901.923376 0.000000e+00
64:             TL      4 2124.380184 1876.340966 2372.419402 0.000000e+00
65:             TL      4 3838.376973 3682.256825 3994.497122 0.000000e+00
66:           TinT      2 3179.339839 3016.600572 3342.079106 0.000000e+00
67:           TinT      3    0.000000    0.000000    0.000000           NA
68:           TinT      3  552.305271  479.669938  624.940604 0.000000e+00
69:           TinT      4   91.922677    7.669529  176.175825 3.250903e-02
70:           TinT      4  659.037134  598.244247  719.830022 0.000000e+00
71:             N0      2 3170.470992 2976.423791 3364.518193 0.000000e+00
72:             N0      3 1970.983364 1693.068225 2248.898503 0.000000e+00
73:             N2      2 6349.810830 6018.120131 6681.501530 0.000000e+00
74:             N2      3 2032.457507 1802.789242 2262.125772 0.000000e+00
75:             N2      3 3527.029881 3259.650878 3794.408884 0.000000e+00
76:             N2      4 2160.254254 1769.653042 2550.855466 0.000000e+00
77:             N2      4 3700.635601 3449.410848 3951.860353 0.000000e+00
78:             N1      2   -8.868847 -143.991200  126.253506 8.976155e-01
79:             N1      3  -61.474142 -215.444275   92.495990 4.336303e-01
80:          NinT2      2 3161.602145 2869.470900 3453.733390 0.000000e+00
81:          NinT2      3  -61.474142 -215.444275   92.495990 4.336303e-01
82:          NinT2      3  338.821195   67.003537  610.638854 1.457478e-02
83:          NinT2      4   66.322605 -166.087675  298.732884 5.757040e-01
84:          NinT2      4  512.426915  356.441697  668.412133 1.329843e-10
85:           NinT      2 3170.470992 2976.423791 3364.518193 0.000000e+00
86:           NinT      3    0.000000    0.000000    0.000000           NA
87:           NinT      3  347.690042  135.341364  560.038721 1.337217e-03
88:           NinT      4  127.796747 -158.880000  414.473495 3.820012e-01
89:           NinT      4  521.295762  329.219320  713.372203 1.088471e-07
90:          dNinT      2   -8.868847 -143.991200  126.253506 8.976155e-01
91:          dNinT      3    0.000000    0.000000    0.000000           NA
92:          dNinT      3 -204.615229 -416.215887    6.985429 5.805394e-02
93:          dNinT      4   35.874070 -217.705970  289.454110 7.814219e-01
94:          dNinT      4 -137.741373 -324.083010   48.600265 1.473551e-01
95: periNrelativeT      2   -8.868847 -143.991200  126.253506 8.976155e-01
96: periNrelativeT      3  -61.474142 -215.444275   92.495990 4.336303e-01
97: periNrelativeT      3 -213.484076 -485.402533   58.434382 1.238251e-01
98: periNrelativeT      4  -25.600072 -224.774069  173.573924 8.009719e-01
99: periNrelativeT      4 -146.610220 -302.775402    9.554963 6.575419e-02
                hv period    estimate          lb          ub       pvalue
####confi <- rbindlist(list(confi, confis), use.names = T, fill = T)
setcolorder(confi, c("FileName", "regtype", "num", "attributes", 
  "hv", "ImpactType", "period", "lb", "estimate", "ub"))
confi <- confi[!(grepl("Con", FileName) & estimate == 0), ]
confi[, attributes := factor(attributes, 
  levels = c("trad", "Large", "LargeGrace", "Cattle",
  "LargeSize", "WithGrace", "InKind"))]
confi[, attributes := factor(attributes, 
  labels = c("Traditional", "Large", "LargeGrace", "Cattle",
  "Upfront", "WithGrace", "InKind"))]
confi[, experience := factor(experience, 
  levels = c("None", "dummyAdiCattle0", "dummyOwnCattle0"))]
confi[, experience := factor(experience, 
  labels = c("None", "AdiCattle", "OwnCattle"))]
#### NumCows reg specs
#### 1. NA,
#### 2. "|NumCows0$",
#### 3. "|Head|Flood|HH",
#### 4. "|^dummyHadCows"
#### 5. "|TotalImp.*0$"
#### NumCowsByExperience reg specs
#### Own subsample (1=OLS, 2=ANCOVA, 3=ANCOVA with covariates, 4=ditto)
#### 1. NA,
#### 2. "|NumCows0$",
#### 3. "|Head|Flood|HH|^NetVa.*0$",
#### 4. "|NumC.*0$"
#### Adi, None subsamples (1=OLS, 3=OLS with covariates)
#### 1. NA, 
#### 2. "", # "|NumC.*0$" is NA if own=none, adi. Lead to error in linear hyp testing. Set to NA.
#### 3. "|Head|Flood|HH|^NetVa.*0$",
#### 4. ""
#### Comparable: 
####  NumCows 1 = 1 in all others
####  NumCows 2 = 2 in Own, 
####  NumCows 3 = 3 in Own, 3 in Adi, None (OLS, though)
confi[, AtType := "Arms (relative to Traditional)"]
confi[grepl("With|Kin", attributes), AtType := "Functional attributes (relative to Upfront, Upfront+WithGrace)"]
confi[grepl("^NinT$|TinT", hv), AtType := "Arms (relative to own in period 2)"]
confi[grepl("N2$|T0|N0", hv), AtType := "Levels"]
confi[, AtType := factor(AtType)]
confi[, regressand := "livestock"]
confi[grepl("Sch", FileName), regressand := "enrollment"]
confi[grepl("Cows$", FileName), regressand := "cattle"]
confi[grepl("CowsEx", FileName), regressand := "cattle, Experience"]
confi[grepl("CowsBy.*a$", FileName), regressand := "cattle, Adi"]
confi[grepl("CowsBy.*o$", FileName), regressand := "cattle, Own"]
confi[grepl("CowsBy.*n$", FileName), regressand := "cattle, None"]
confi[grepl("^NetAssets", FileName), regressand := "net assets"]
confi[grepl("^NetBroad.*ts$", FileName), regressand := "net broad assets"]
confi[grepl("^Net.*ea$", FileName), regressand := "net assets, Adi"]
confi[grepl("^Net.*eo$", FileName), regressand := "net assets, Own"]
confi[grepl("^Net.*en$", FileName), regressand := "net assets, None"]
confi[grepl("Net.*Pri", FileName), regressand := "net assets, AP"]
confi[grepl("tsEx", FileName), regressand := gsub("$", ", Experience", regressand)]
####confi[grepl("^AssetL", FileName), regressand := "broad total assets"]
confi[grepl("^NetNL", FileName), regressand := "net non-livestock assets"]
confi[grepl("Lan", FileName), regressand := "land"]
confi[grepl("Lab", FileName), regressand := "labour incomes"]
confi[grepl("Consumption$", FileName), regressand := "consumption"]
confi[grepl("ConsumptionO", FileName), regressand := "consumption, OLS"]
confi[, FileName := gsub("^Asset", "BroadAsset", FileName)]
confi[, FileName := gsub("ByExperiencea", "Adi", FileName)]
confi[, FileName := gsub("ByExperienceo", "Own", FileName)]
confi[, FileName := gsub("ByExperiencen", "None", FileName)]
confi[, regressand := factor(regressand)]
confi[, FileName := factor(FileName)]
####confi[grepl("far", FileName), regressand := "farm incomes"]
#### confi[grepl("sv", FileName), regressand := "net saving"]
#### confi[grepl("sv.[45]", FileName), regressand := "repayment"]
#### confi[grepl("sv.[78]", FileName), regressand := "effective repayment"]
#### confi[grepl("sc", FileName), regressand := "schooling"]
confi[, attributes := factor(attributes, levels = 
  c("Traditional", "Large", "LargeGrace", "Cattle", "Upfront", "WithGrace", "InKind"))]
confi[, regressand := factor(regressand, levels = 
  c("land", "livestock", #"broad total assets", 
    "net non-livestock assets", 
    paste0(rep(c("net assets", "cattle"), each = 5), 
      rep(c("", ", Adi", ", None", ", Own", ", Experience"), 2))
    , "net broad assets", "net assets, AP", 
    "enrollment", "consumption", "consumption, OLS", "labour incomes")
      )]
saveRDS(confi, paste0(pathsaveHere, "EstimatesCI.rds"))
qsave(confi, paste0(pathsaveHere, "EstimatesCI.qs"))
saveRDS(linhyp, paste0(pathsaveHere, "LinearHypothesis.rds"))

Tests for schooling outcomes

Click here to see the code to run hypothesis testing for schooling.
library(car)
library(multcomp)
#### schooling
screglists <-  paste0("sc", 2:3)
schlevels <- c("primary", "junior", "high")
covadd <- covaddsch 
confis <- NULL
rr <- 4; s <- 2
r <- 1; g <- "Large"
for (rr in 1:length(reglists[[r]])) {
  # rr: regression type: "sc", "sca", "scP", "scT", "scTa", ....
  # regobj: e.g., "scT" with 7 regression specifications: 
  # specification s (from SchoolingCovariateSelectionANCOVA2.R):
  # 1. NA,
  # 2.  "|Enrolled0$",
    # add {dummyJunior/dummyHigh} and
    # {Arms}*{dummyJunior/dummyHigh} or
    # {Arms}*{dummyJunior/dummyHigh}*{Time.x}
  # 3.  "|^dummy[JH].*[rh]$|^dummy[CI].*[ed]\\.dummy[JH].*[rh]$|^dummy[LW].*[cgz]e\\.dummy[JH].*[rh]$|^dummy[JH].*[rh]\\.T|^dummy[CI].*[ed]\\.dummy[JH].*[rh]\\.T|^dummy[LW].*[cgz]e\\.dummy[JH].*[rh]\\.T",
  # 4.  "|ChildAge|Eldest|Head.*0|HHsize0|Flood",
    # add {Arms}*{dummyJunior/dummyHigh}*{Female}
    # {Arms}*{dummyJunior/dummyHigh}*{Female}*{Time.x}
  # 5. "|Female",
   #6. "|ChildAge|Eldest|Head.*0|HHsize0|Flood"
  regtype <- gsub("^..", "", reglists[[r]][rr])
  if (grepl("a", regtype)) 
    lattributes <- lattributeList[[2]] else
    lattributes <- lattributeList[[1]]
  regobj <- robj[[r]][[rr]]
  lmlist <- lapply(regobj, "[[", "lm")
  coefflist <- lapply(lmlist, "[[", "coefficients")
  # check NAs in coeff
  lapply(1:length(coefflist), function(i) c(i, names(coefflist[[i]])[is.na(coefflist[[i]])]))
  coefflist <- lapply(coefflist, function(x) x[!is.na(x)])
  Vlist <- lapply(lapply(regobj, "[[",  "robust"), "[[", "V")
  Mult <- 1
  covadd.trad <- lapply(covaddsch, function(x) x[1])
  # s-th specification
  for (s in 2:length(regobj)) {
    thisreg <- regobj[[s]]$lm
    coeffvec <- thisreg$coeff
    thisV <- regobj[[s]]$robust$V
    thisres <- regobj[[s]]$robust$est
    for (g in lattributes) {
      # lattributes: 
      #  Arms (Large, LargeGrace, Cattle) or 
      #  functional attributes (Upfront, Grace, InKind)
      addcova <- lapply(covaddsch, function(x) gsub("XX", g, x))
      # covaddsch[1]: $MofT: \\(Intercept\\), ^dummyJunior$, ^dummyHigh$
      # covaddsch[2]: $FofT: ^Female$, ^dummyJunior.Female$, ^dummyHigh.Female$
      # covaddsch[4]: $FofN: ^dummyXX.Female$, ^dummyXX.dummyJunior.Female$,
      #   ^dummyXX.dummyHigh.Female$
      # covaddsch[7]: $MofNinT: ^dummyXX.TimeYY$, ^dummyXX.dummyJunior.TimeYY$,
      #   ^dummyXX.dummyHigh.TimeYY$
      # So, for example, g = Large gives
      # addcova[4]: $FofN: ^dummyLarge.Female$, ^dummyLarge.dummyJunior.Female$,
      #   ^dummyLarge.dummyHigh.Female$
      # addcova[7]: $MofNinT: ^dummyLarge.TimeYY$, ^dummyLarge.dummyJunior.TimeYY$,
      #   ^dummyLarge.dummyHigh.TimeYY$
      # names(addcova): MofT, FofT, MofN, FofN, MofTinT, FofTinT, MofNinT, FofNinT
      #   male of trad, female of trad, male of nontrad, female of nontrad, 
      #   male of trad in T, female of trad in T, male of nontrad in T, female of nontrad in T
      for (gg in names(addcova))
        assign(paste0("addcova", gg), addcova[[gg]])
      # i: school level
      # addcovaMofT: \\(Intercept\\), ^dummyJunior$, ^dummyHigh$
      for (i in 1:length(addcovaMofT)) {
        # hvMofTA: average change = 0 (of males in trad school i)
        #  Intercept + School 
        #  = MofT
        #  [[1]]"\\(Intercept\\)" "^dummyJunior$"   "^dummyHigh$"
        hvMofTA <- rep(0, length(coeffvec))
        # i picks up: 1 = primary, 2 = primary+dJunior, 3 = primary+dHigh
        hvMofTA[grepl(
             paste0(unique(addcovaMofT[c(1, i)]), collapse = "|")
            , names(coeffvec))] <- 1*Mult
        if (any(is.na(coeffvec))) hvMofTA <- hvMofTA[!is.na(coeffvec)]
        lhcow <- glht(model=thisreg, linfct = matrix(hvMofTA, byrow = T, nrow=1), 
          alternative="two.sided", vcov.=thisV)
        confis <- rbind(confis, 
           c(FileNames[r], regtype, s, "traditional", "male", schlevels[i], 
             "level of reference trad", "2-4", "MofTA", 
             confint(lhcow)$confint[1, ], 
             if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
           )
        # hvFofTA: average change = 0 (of females in trad school i)
        # addcovaFofT: ^Female$, ^dummyJunior.Female$, ^dummyHigh.Female$
        # Intercept+School+^Female$+Female.School
        # = hvMofTA + dFofT
        # For s < 4: There is no Female term. This copies male coefficient.
        # Just use male estimates and label them as "all".
        # After the loop, 
        #  drop s<4 & grepl("female", gender), rewrite "male" => "all"
        hvFofTA <- dFofT <- rep(0, length(coeffvec))
        dFofT[grepl(
             paste0(addcovaFofT[c(1, i)], collapse = "|")
            , names(coeffvec))] <- 1*Mult
        hvFofTA <- hvMofTA + dFofT
        lhcow <- glht(model=thisreg, linfct = matrix(hvFofTA, byrow = T, nrow=1), 
          alternative="two.sided", vcov.=thisV)
        confis <- rbind(confis, 
           c(FileNames[r], regtype, s, "traditional", "female", schlevels[i], 
             "level of reference female trad", "2-4", "FofTA", 
             confint(lhcow)$confint[1, ], 
             if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
           )
        # nontrad
        # construct coefficient names for attribute g
        covadd.nontrad <- lapply(covadd, function(x) gsub("XX", g, x))
        # gross = trad + delta.Arm
        # hvMofNA: average change = 0 (of nontrad arm g at school i)
        # addcovaMofT: \\(Intercept\\), ^dummyJunior$, ^dummyHigh$
        # addcovaMofN: ^dummyLarge$, ^dummyLarge.dummyJunior$, ^dummyLarge.dummyHigh$
        # intercept + School + Arm + Arm.School 
        # = hvMofTA + dMofN
        #  [[1]]"\\(Intercept\\)", "School", "dummyInKind.School"
        dMofNA <- rep(0, length(coeffvec))
        dMofNA[grepl(
             paste0(addcovaMofN[c(1, i)], collapse = "|")
            , names(coeffvec))] <- 1*Mult
        hvMofNA <- hvMofTA + dMofNA
        lhcow <- glht(model=thisreg, linfct = matrix(hvMofNA, byrow = T, nrow=1), 
          alternative="two.sided", vcov.=thisV)
        confis <- rbind(confis, 
             c(FileNames[r], regtype, s, g, "male", schlevels[i], 
               "level of nontrad at school", "2-4", "MofNA", 
               confint(lhcow)$confint[1, ], 
               if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
          )
        # hvFofNA: average change = 0 (of female nontrad Arm g at School i)
        #  \\(Intercept\\)+Arm+School+Female+Arm.School+Arm.Female+School.Female+Arm.School.Female
        #  \\(Intercept\\)+Arm+School+Arm.School + Female+School.Female + Arm.Female+Arm.School.Female
        # hvMofNA + dFofT + dFofNA
        dFofNA <- rep(0, length(coeffvec))
        dFofNA[grepl(
             paste0(addcovaFofN[c(1, i)], collapse = "|")
            , names(coeffvec))] <- 1*Mult
        hvFofNA <- hvMofNA + dFofT + dFofNA
        lhcow <- glht(model=thisreg, linfct = matrix(hvFofNA, byrow = T, nrow=1), 
          alternative="two.sided", vcov.=thisV)
        confis <- rbind(confis, 
             c(FileNames[r], regtype, s, g, "female", schlevels[i], 
               "level of female nontrad at school", "2-4", "FofNA", 
               confint(lhcow)$confint[1, ], 
               if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
          )
        # hvMofN: average difference = 0 (of nontrad Arm g relative to trad, at School i)
        #  hvMofNA - hvMofTA = Arm + Arm.School
        #  dummyInKind + dummyInKind.School
        hvMofN <- hvMofNA - hvMofTA
        lhcow <- glht(model=thisreg, linfct = matrix(hvMofN, byrow = T, nrow=1), 
          alternative="two.sided", vcov.=thisV)
        confis <- rbind(confis, 
             c(FileNames[r], regtype, s, g, "male", schlevels[i], 
               "nontrad - trad, at school", "2-4", "MofN", 
               confint(lhcow)$confint[1, ], 
               if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
          )
        # hvFofN: difference = 0 (of nontrad Arm g females to trad females, at School i)
        #  hvFofNA - hvFofTA = Arm + Arm.School + Arm.Female + Arm.School.Female
        #  = hvMofN + dFofNA
        hvFofN <- hvMofN + dFofNA
        lhcow <- glht(model=thisreg, linfct = matrix(hvFofN, byrow = T, nrow=1), 
          alternative="two.sided", vcov.=thisV)
        confis <- rbind(confis, 
             c(FileNames[r], regtype, s, g, "female", schlevels[i], 
               "female nontrad - female trad, at school", "2-4", "FofN", 
               confint(lhcow)$confint[1, ], 
               if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
          )
        for (tee in 2:4) {
          for (gg in names(addcova)) {
            # for gg (each comparison addcova), substitute period = 3, 4 to YY
            adc <- get(paste0("addcova", gg))
            assign(paste0("addtee", gg), gsub("YY", tee, adc))
            # addcovaMofNinT: ^dummyLarge.TimeYY$, ^dummyLarge.dummyJunior.TimeYY$,
            #   ^dummyLarge.dummyHigh.TimeYY$
            # So, for example, tee = 3 gives
            # addteeMofNinT: ^dummyLarge.Time3$, ^dummyLarge.dummyJunior.Time3$,
            #   ^dummyLarge.dummyHigh.Time3$
            # addcovaFofNinT: ^dummyInKind.Female.TimeYY, 
            #  ^dummyInKind.dummyJunior.Female.TimeYY$, 
            #  ^dummyInKind.dummyHigh.Female.TimeYY$
            # So, for example, tee = 3 gives
            # addteeFofNinT: ^dummyInKind.Female.Time3, 
            #  ^dummyInKind.dummyJunior.Female.Time3$, 
            #  ^dummyInKind.dummyHigh.Female.Time3$
          }
          # hvMofTinT: trad timeX - trad period 2, at school i
          #  School + TimeX + School.TimeX - School
          #  = TimeX + School.TimeX
          #  at tee == 2, (trad timeX - trad period 2, at school i) = 0
          hvMofTinT <- rep(0, length(coeffvec))
          if (tee > 2) 
            hvMofTinT[grepl(
               paste0(addteeMofTinT[c(1 ,i)], collapse = "|")
               , names(coeffvec))] <- 1*Mult
          lhcow <- glht(model=thisreg, linfct = matrix(hvMofTinT, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, "traditional", "male", schlevels[i], 
                 "trad in each period - trad in period 2, at school", tee, 
                 "MofTinT", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
          # female
          # hvFofTinT: female trad timeX - female trad period 2, at school i
          #  School + TimeX + Female
          #   + School.TimeX + School.Female + Female.TimeX + School.Female.TimeX 
          #   - (School + Female + School.Female)
          #  = TimeX + School.TimeX  (hvMofTinT)
          #     +Female.TimeX + School.Female.TimeX ... dFofTinT
          #  = hvMofTinT                + dFofTinT
          #  at tee == 2, (female trad timeX - female trad period 2, at school i) = 0
          dFofTinT <- rep(0, length(coeffvec))
          if (tee > 2) 
            dFofTinT[grepl(
              paste0(addteeFofTinT[c(1 ,i)], collapse = "|")
              , names(coeffvec))] <- 1*Mult
          hvFofTinT <- hvMofTinT + dFofTinT
          lhcow <- glht(model=thisreg, linfct = matrix(hvFofTinT, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, "traditional", "female", schlevels[i], 
                 "female trad in each period - period 2 female trad, at school", tee, 
                 "FofTinT", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
          # hvMofTinTL: cumulative change = 0 (of trad school i in period X)
          # Intercept+School+TimeX+School.TimeX
          #  = hvMofTA + hvMofTinT
          # if tee == 2
          #   Intercept+School = hvMofTA
          hvMofTinTL <- hvMofTA + hvMofTinT
          if (tee == 2) hvMofTinTL <- hvMofTA
          lhcow <- glht(model=thisreg, linfct = matrix(hvMofTinTL, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, "traditional", "male", schlevels[i], 
                 "level of trad in each period, at school", tee, 
                 "MofTinTL", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
          hvFofTinTL <- hvFofTA + hvFofTinT
          if (tee == 2) hvFofTinTL <- hvFofTA
          lhcow <- glht(model=thisreg, linfct = matrix(hvFofTinTL, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, "traditional", "female", schlevels[i], 
                 "level of female trad in each period, at school", tee, 
                 "FofTinTL", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
          # dMofNinT: diff = 0 (of nontrad change relative to concurrent trad change, at school iin period X)
          #  TimeX + Arm.TimeX + School.TimeX + Arm.School.TimeX 
          #    - (TimeX + School.TimeX)
          #  = Arm.TimeX + Arm.School.TimeX 
          # addteeMofNinT: ^dummyLarge.Time3$, ^dummyLarge.dummyJunior.Time3$,
          #   ^dummyLarge.dummyHigh.Time3$
          dMofNinT <- dFofNinT <- dFofNinT0 <- rep(0, length(coeffvec))
          dMofNinT[grepl(
            paste0(addteeMofNinT[c(1 ,i)], collapse = "|")
            , names(coeffvec))] <- 1*Mult
          # if tee == 2: Arm + Arm.School = hvMofN
          if (tee == 2) dMofNinT <- hvMofN
          lhcow <- glht(model=thisreg, linfct = matrix(dMofNinT, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, g, "male", schlevels[i], 
                 "nontrad change - trad change, in each period, at school", tee, 
                 "dMofNinT", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
          # hvMofNinT: diff = 0 (of nontrad relative to concurrent trad, at school iin period X)
          #  Arm + School + TimeX + Arm.School + Arm.TimeX + School.TimeX + Arm.School.TimeX 
          #    - (School + TimeX + School.TimeX)
          #  = Arm + Arm.School + Arm.TimeX + Arm.School.TimeX 
          #  = hvMofTinT + dMofNinT
          # addteeMofNinT: ^dummyLarge.Time3$, ^dummyLarge.dummyJunior.Time3$,
          #   ^dummyLarge.dummyHigh.Time3$
          hvMofNinT <- hvMofTinT + dMofNinT
          # hvMofN (Arm + Arm.School)
          if (tee == 2) hvMofNinT <- hvMofN
          lhcow <- glht(model=thisreg, linfct = matrix(hvMofNinT, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, g, "male", schlevels[i], 
                 "nontrad - trad, in each period, at school", tee, 
                 "MofNinT", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
          # dFofNinT: diff = 0 (of female nontrad change relative to concurrent female trad change, at school i in period X)
          #  TimeX + Arm.TimeX + Female.TimeX + School.TimeX + 
          #   + Arm.School.TimeX + Arm.Female.TimeX + Female.School.TimeX 
          #   + Arm.School.Female.TimeX 
          #    - (TimeX + Female.TimeX + School.TimeX + Female.School.TimeX)
          #  = Arm.TimeX + Arm.School.TimeX + Arm.Female.TimeX
          #   + Arm.School.Female.TimeX 
          #  = dMofNinT + Arm.Female.TimeX + Arm.School.Female.TimeX
          #  = dMofNinT + dFofNinT0
          # addteeFofNinT:  "^dummyInKind.Female.Time4$, 
          #  ^dummyInKind.dummyJunior.Female.Time4$, 
          #  ^dummyInKind.dummyHigh.Female.Time4$
          dFofNinT0[grepl(
            paste0(addteeFofNinT[c(1 ,i)], collapse = "|")
            , names(coeffvec))] <- 1*Mult
          dFofNinT <- dMofNinT + dFofNinT0
          # if tee == 2: Arm.TimeX + Arm.School.TimeX + Arm.Female.TimeX
          #   + Arm.School.Female.TimeX 
          #  =  Arm + Arm.School + Arm.Female+ Arm.School.Female
          #  = hvFofN
          if (tee == 2) dFofNinT <- hvFofN
          lhcow <- glht(model=thisreg, linfct = matrix(dFofNinT, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, g, "female", schlevels[i], 
                 "female nontrad change - female trad change, in each period, at school", tee, 
                 "dFofNinT", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
          # hvFofNinT: diff = 0 (of female nontrad relative to concurrent female trad, at school iin period X)
          #  Arm + Arm.School + Arm.Female + Arm.TimeX + 
          #  Arm.School.Female + Arm.School.TimeX + Arm.Female.TimeX + 
          #  Arm.School.Female.TimeX
          #  = Arm + Arm.School  (MofN)
          #   + Arm.Female + Arm.School.Female  (dFofNA)
          #   + Arm.TimeX + Arm.School.TimeX (dMofNinT)
          #   +  Arm.Female.TimeX + Arm.School.Female.TimeX  (dFofNinT0)
          #  = hvMofN + dFofNA + dMofNinT + dFofNinT0
          #  = hvMofN + dFofNA + dFofNinT
          hvFofNinT <- hvMofN + dFofNA + dFofNinT
          # if tee == 2,
          #  = Arm + Arm.School  (MofN)
          #   + Arm.Female + Arm.School.Female  (dFofNA)
          #  = hvFofN
          if (tee == 2) hvFofNinT <- hvMofN + dFofNA
          lhcow <- glht(model=thisreg, linfct = matrix(hvFofNinT, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, g, "female", schlevels[i], 
                 "female nontrad - female trad, in each period, at school", 
                 tee, "FofNinT", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
          # hvMofNinTL: cumulative change = 0 (of nontrad school i in period X)
          #  (intercept) + School + TimeX + School.TimeX 
          #    + Arm + Arm.School 
          #    + Arm.TimeX + Arm.School.TimeX 
          #  = hvMofTinTL + hvMofN + hvMofNinT
          hvMofNinTL <- hvMofTinTL + hvMofN + hvMofNinT
          #  if tee == 2
          #  (intercept) + School + Arm + Arm.School 
          #  = hvMofTA
          if (tee == 2) hvMofNinTL <- hvMofTA
          lhcow <- glht(model=thisreg, linfct = matrix(hvMofNinT, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, g, "male", schlevels[i], 
                 "level of nontrad in each period at school", tee, 
                 "MofNinTL", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
          # hvFofNinTL: cumulative change = 0 (of female nontrad school i in period X)
          #  (intercept) + School + TimeX + School.TimeX 
          #   + Arm + Arm.School 
          #   + Arm.TimeX + Arm.School.TimeX 
          #   + Female + School.Female  (dFofT)
          #   + Female.TimeX + School.Female.TimeX (dFofTinT)
          #   + Arm.Female + Arm.School.Female  (dFofNA)
          #   +  Arm.Female.TimeX + Arm.School.Female.TimeX  (dFofNinT0)
          # = hvMofNinTL + dFofT + dFofTinT + dFofNA + dFofNinT0
          hvFofNinTL <- hvMofTinTL + dFofT + dFofTinT + dFofNA + dFofNinT0
          #  if tee == 2
          #  (intercept) + School + Arm + Arm.School  (hvMofTA)
          #   + Female + School.Female  (dFofT)
          #   + Arm.Female + Arm.School.Female  (dFofNA)
          if (tee == 2) hvFofNinTL <- hvMofTA + dFofT + dFofNA
          lhcow <- glht(model=thisreg, linfct = matrix(hvFofNinTL, 
            byrow = T, nrow=1), alternative="two.sided", vcov.=thisV)
          confis <- rbind(confis, 
               c(FileNames[r], regtype, s, g, "female", schlevels[i], 
                 "level of female nontrad in each period at school", 
                 tee, "FofNinTL", 
                 confint(lhcow)$confint[1, ], 
                 if (sum(lhcow$linfct) != 0) summary(lhcow)$test$pvalues[1] else NA)
            )
        }  # end: TimeT tee loop
      } # end: school level i loop
    } # end: attribute g loop
  } # end: specification s loop
} # end: regression type rr loop
confis <- data.table(confis)
setnames(confis, c("FileName", "regtype", "num", "attributes", 
  "gender", "school", "ImpactType", "period", "hv", "estimate", "lb", "ub", "pvalue"))
 # traditional has 4 same entries when computing interactions 
confis <- confis[!duplicated(confis), ]
#### drop: b, a, P have zero in time interaction tests (e.g., TimeX + Arm.TimeX for X == 2)
confis <- confis[estimate != 0, ]
numcols <- c("period", "estimate", "lb", "ub", "num", "pvalue")
confis[, (numcols) := lapply(.SD, as.numeric), .SDcols = numcols]
#### drop: females are only added for specification s >= 5 & regtype = T, rewrite "male" => "all"
confis <- confis[!(num < 5 & grepl("female", ImpactType)), ]
#### Note: rewrite "male" => "all" for num < 5, 
#### we are losing gender = "male" entries for specification < 5. 
#### Need to get gender = all entries for graphs. But this should not be a problem 
#### as we need "male" entries only when we contrast with females (num>=5).
confis[num < 5 & grepl("male", gender), gender := "all"]
confis[grepl("T", regtype) & num < 5 & grepl("ref", ImpactType), ][
  order(regtype, num, attributes, ImpactType, period), ]
     FileName regtype   num  attributes gender  school              ImpactType period     hv
       <char>  <char> <num>      <char> <char>  <char>                  <char>  <num> <char>
 1: Schooling       T     2 traditional    all primary level of reference trad     NA  MofTA
 2: Schooling       T     2 traditional    all  junior level of reference trad     NA  MofTA
 3: Schooling       T     2 traditional    all    high level of reference trad     NA  MofTA
 4: Schooling       T     3 traditional    all primary level of reference trad     NA  MofTA
 5: Schooling       T     3 traditional    all  junior level of reference trad     NA  MofTA
 6: Schooling       T     3 traditional    all    high level of reference trad     NA  MofTA
 7: Schooling       T     4 traditional    all primary level of reference trad     NA  MofTA
 8: Schooling       T     4 traditional    all  junior level of reference trad     NA  MofTA
 9: Schooling       T     4 traditional    all    high level of reference trad     NA  MofTA
10: Schooling      Ta     2 traditional    all primary level of reference trad     NA  MofTA
11: Schooling      Ta     2 traditional    all  junior level of reference trad     NA  MofTA
12: Schooling      Ta     2 traditional    all    high level of reference trad     NA  MofTA
13: Schooling      Ta     3 traditional    all primary level of reference trad     NA  MofTA
14: Schooling      Ta     3 traditional    all  junior level of reference trad     NA  MofTA
15: Schooling      Ta     3 traditional    all    high level of reference trad     NA  MofTA
16: Schooling      Ta     4 traditional    all primary level of reference trad     NA  MofTA
17: Schooling      Ta     4 traditional    all  junior level of reference trad     NA  MofTA
18: Schooling      Ta     4 traditional    all    high level of reference trad     NA  MofTA
     estimate        lb        ub       pvalue
        <num>     <num>     <num>        <num>
 1: 0.6549961 0.5706943 0.7392978 0.000000e+00
 2: 0.6549961 0.5706943 0.7392978 0.000000e+00
 3: 0.6549961 0.5706943 0.7392978 0.000000e+00
 4: 0.7036368 0.6286568 0.7786168 0.000000e+00
 5: 0.5587881 0.4634733 0.6541029 0.000000e+00
 6: 0.4651104 0.3750613 0.5551595 0.000000e+00
 7: 0.8167770 0.6799279 0.9536260 0.000000e+00
 8: 0.6986848 0.5471346 0.8502350 0.000000e+00
 9: 0.6065558 0.4477207 0.7653910 1.083578e-13
10: 0.6549961 0.5706943 0.7392978 0.000000e+00
11: 0.6549961 0.5706943 0.7392978 0.000000e+00
12: 0.6549961 0.5706943 0.7392978 0.000000e+00
13: 0.7036368 0.6286568 0.7786168 0.000000e+00
14: 0.5587881 0.4634733 0.6541029 0.000000e+00
15: 0.4651104 0.3750613 0.5551595 0.000000e+00
16: 0.8167770 0.6799279 0.9536260 0.000000e+00
17: 0.6986848 0.5471346 0.8502350 0.000000e+00
18: 0.6065558 0.4477207 0.7653910 1.083578e-13
faccols <- c("FileName", "regtype", "attributes", "ImpactType", "hv", "gender", "school")
confis[, (faccols) := lapply(.SD, as.factor), .SDcols = faccols]
confis[, ImpactType := factor(ImpactType, 
  levels = c(
    "level of reference trad",
    "level of reference female trad",
    "level of trad in each period, at school",
    "level of female trad in each period, at school",
    "trad in each period - trad in period 2, at school",
    "female trad in each period - period 2 female trad, at school",
    "level of nontrad at school",
    "level of female nontrad at school",
    "level of nontrad in each period at school",
    "level of female nontrad in each period at school",
    "nontrad - trad, at school",
    "female nontrad - female trad, at school",
    "nontrad change - trad change, in each period, at school",
    "female nontrad change - female trad change, in each period, at school",
    "nontrad - trad, in each period, at school",
    "female nontrad - female trad, in each period, at school"
  ))]
confis[, ImpactType := factor(ImpactType, 
  labels = c(
    "level of reference trad",
    "level of reference female trad",
    "level of trad in each period at school",
    "level of female trad in each period at school",
    "trad in each period - trad in period 2, at school",
    "female trad in each period - period 2 female trad, at school",
    "level of nontrad at school",
    "level of female nontrad at school",
    "level of nontrad in each period at school",
    "level of female nontrad in each period at school",
    "nontrad - trad, at school",
    "female nontrad - female trad, at school",
    "nontrad change - trad change, in each period, at school",
    "female nontrad change - female trad change, in each period, at school",
    "nontrad - trad, in each period, at school",
    "female nontrad - female trad, in each period, at school"
  ))]
confis[, hv := factor(hv, 
  levels = c(
  "MofTA", "FofTA", "MofNA", "FofNA", "MofN", "FofN",
   "MofTinT", "FofTinT", "MofTinTL", "FofTinTL",
   "dMofNinT", "dFofNinT", "MofNinT" , "FofNinT",
   "MofNinTL", "FofNinTL"
  ))]
confis[, school := factor(school, levels = c("primary", "junior", "high"))]
confis[!grepl("T", regtype), period := NA]
setcolorder(confis, c("FileName", "regtype", "num", "attributes", 
  "ImpactType", "period", "lb", "estimate", "ub"))
confis[, attributes := factor(attributes, 
  levels = c("traditional", "Large", "LargeGrace", "Cattle",
  "LargeSize", "WithGrace", "InKind"))]
confis[, attributes := factor(attributes, 
  labels = c("Traditional", "Large", "LargeGrace", "Cattle",
  "Upfront", "WithGrace", "InKind"))]
confis[, AtType := "Arms (relative to Traditional)"]
confis[grepl("With|Kin", attributes), AtType := "Functional attributes (relative to Upfront, Upfront+WithGrace)"]
confis[, AtType := factor(AtType)]
saveRDS(confis, paste0(pathsaveHere, "EstimatesCISchooling.rds"))
qsave(confis, paste0(pathsaveHere, "EstimatesCISchooling.qs"))
confis[grepl("^.ofNinT$", hv) & grepl("T$", regtype) & grepl("ge$", attributes) & 
  grepl("j", school) & num == 5, ][order(gender, period), ]
    FileName regtype   num attributes                                              ImpactType
      <fctr>  <fctr> <num>     <fctr>                                                  <fctr>
1: Schooling       T     5      Large female nontrad - female trad, in each period, at school
2: Schooling       T     5      Large female nontrad - female trad, in each period, at school
3: Schooling       T     5      Large female nontrad - female trad, in each period, at school
4: Schooling       T     5      Large               nontrad - trad, in each period, at school
5: Schooling       T     5      Large               nontrad - trad, in each period, at school
6: Schooling       T     5      Large               nontrad - trad, in each period, at school
   period         lb     estimate         ub gender school      hv    pvalue
    <num>      <num>        <num>      <num> <fctr> <fctr>  <fctr>     <num>
1:      2 -0.4071382 -0.172937656 0.06126292 female junior FofNinT 0.1477282
2:      3 -0.2603041  0.035773671 0.33185146 female junior FofNinT 0.8127103
3:      4 -0.3920791 -0.095465521 0.20114804 female junior FofNinT 0.5279733
4:      2 -0.1407314 -0.000432567 0.13986623   male junior MofNinT 0.9951760
5:      3 -0.1947368  0.001223819 0.19718439   male junior MofNinT 0.9902289
6:      4 -0.2433969  0.009168600 0.26173405   male junior MofNinT 0.9432495
                           AtType
                           <fctr>
1: Arms (relative to Traditional)
2: Arms (relative to Traditional)
3: Arms (relative to Traditional)
4: Arms (relative to Traditional)
5: Arms (relative to Traditional)
6: Arms (relative to Traditional)

Below is a snippet of estimated objects:

dMofT=addcovaMofT[c(1, i)] (Intercept), dummyJunior, dummyHigh

dFofT=addcovaFofT[c(1, i)] Female, dummyJunior.Female, dummyHigh.Female

dMofNA=addcovaMofN[c(1, i)] dummyInKind, dummyInKind.dummyJunior, dummyInKind.dummyHigh

dFofNA=addcovaFofN[c(1, i)] dummyInKind.Female, dummyInKind.dummyJunior.Female, dummyInKind.dummyHigh.Female

hvMofTinT=addteeMofTinT[c(1 ,i)] Time.4, dummyJunior.Time4, dummyHigh.Time4

dFofTinT=addteeFofTinT[c(1 ,i)] Female.Time4, dummyJunior.Female.Time4, dummyHigh.Female.Time4

dMofNinT=addteeMofNinT[c(1 ,i)] dummyInKind.Time4, dummyInKind.dummyJunior.Time4, dummyInKind.dummyHigh.Time4

dFofNinT=addteeFofNinT[c(1 ,i)] dummyInKind.Female.Time4, dummyInKind.dummyJunior.Female.Time4, dummyInKind.dummyHigh.Female.Time4

Results plots

Raw outcomes

Assets

Mean asset outcomes by arm and period.

Click here to see the code to produce plots.
#### Run ComputeNetAssetsANCOVA.R first to produce 
#### various "Figure" data. This is ran in 
#### ### Descriptive statistics as a knitr child file.
#### source(paste0(pathprogram, "ComputeNetAssetsANCOVA.R"))
NeA1R <- readRDS(paste0(pathsaveHere, 
  "NetAssetsANCOVATrimmed.rds"))
cpn <- NeA1R[(CompleteAssetPanel) & tee == 1,
  .(Arm, hhid, tee, 
   CP=CompleteAssetPanel, NLHAssetAmount, 
   PAssetAmount, NumCows)]
#### comple asset panel sample is only 220 HHs 
#### and only 35 HHs for traditional
lvoD <- readRDS(paste0(pathsaveHere, 
  "NumCowsFigure.rds"))
nAD <- readRDS(paste0(pathsaveHere, 
  "AllNetAssetsFigureMeanData.rds"))
cpn <- readRDS(paste0(pathsaveHere, 
  "CPNetAssetsFigureMeanData.rds"))
conD <- readRDS(paste0(pathsaveHere, 
  "ConsumptionFigure.rds"))
labDHH <- readRDS(paste0(pathsaveHere, 
  "HHLabourIncomeFigure.rds"))
labDpc <- readRDS(paste0(pathsaveHere, 
  "pcHHLabourIncomeFigure.rds"))
schD <- readRDS(paste0(pathsaveHere, 
  "SchoolingFigure.rds"))
schD[, file := Schooling]
#### break down various asset measures in nAD
nAD[grepl("cow", Arm), Arm := "cattle"]
armsC <- c("traditional", "large", "large grace", "cattle")
nAD[, Arm := factor(Arm, levels = armsC)]
na <- nAD[, .(Arm, tee, NetValue..mean, NetValue..upper, 
  NetValue..lower, NetValue..N)]
pal <- nAD[, .(Arm, tee, ProdValue..mean, ProdValue..upper, 
  ProdValue..lower, ProdValue..N)]
pa <- nAD[, .(Arm, tee, PAssetAmount..mean, 
  PAssetAmount..upper, PAssetAmount..lower, PAssetAmount..N)]
cpn <- cpn[, .(Arm, tee, NetValue..mean, NetValue..upper, 
  NetValue..lower, NetValue..N)]
setnames(na, grepout("Ne", colnames(na)), 
  c("mean", "upper", "lower", "N"))
setnames(pal, colnames(na))
setnames(pa, colnames(na))
setnames(cpn, colnames(na))
figD <- rbindlist(list(
  cbind(file = "NumCows", lvoD),
  cbind(file = "PAssetAmount", pa),
  cbind(file = "ProdValue", pal),
  cbind(file = "NetAssets", na),
  cbind(file = "CPNetAssets", cpn),
  cbind(file = "Consumption", conD),
  cbind(file = "HHLabourIncomes", labDHH),
  cbind(file = "pcHHLabourIncomes", labDpc),
  schD[, .(file, Arm, sex, tee, lower, mean, upper, N)]
  ), use.names = T, fill = T)
figD[, file := factor(file, levels = c(
  "NumCows", "PAssetAmount", "ProdValue",
  "NetAssets", "CPNetAssets", 
  "Consumption", "HHLabourIncomes", "pcHHLabourIncomes",
  "primary0512", "junior1315", "high1618"))]
figD[, file := factor(file, labels = c(
  "NumCows", "PAssetAmount", "ProdValue",
  "NetAssets", "CPNetAssets", 
  "Consumption", "HHIncomes", "pcIncomes",
  "Sch0512", "Sch1315", "Sch1618"))]
figD[is.na(sex), sex := "NA"]
figD[, sex := factor(sex, labels = c("M", "F", "NA"))]
figD[, Sex := factor(sex, labels = 
  c("Male", "Female", "Per household"))]
figD[grepl("tra", Arm), Arm := "Traditional"]
figD[grepl("ge$", Arm), Arm := "Large"]
figD[grepl("ce$", Arm), Arm := "LargeGrace"]
figD[grepl("^ca", Arm), Arm := "Cattle"]
figD[, Arm := factor(Arm, levels = c(Arms[-4], "Cattle"))]
saveRDS(figD, paste0(pathsaveHere, "figD.rds"))

Consumption and labour incomes

Mean consumption and income outcomes by arm and period.

Click here to see the code to produce plot.

Saving and repayment

Click here to see the code of cumulative repayment plots.
library(ggplot2)
ga <- arA[!is.na(Date) & !is.na(DisDate1) & grepl("Yes", creditstatus), 
  .(Arm, hhid, povertystatus, MonthsElapsed, 
  DebtOutstanding, CumLoanAmount, value.repay, value.NetSaving, 
  CumPlannedInstallment, CumRepaidRate, CumEffectiveRepaidRate)]
ga <- arA[!is.na(Date) & !is.na(DisDate1) & grepl("Yes", creditstatus), 
  .(Arm, hhid, povertystatus, MonthsElapsed, 
  value.NetSaving, CumRepaid)]
ga1 <- ga[, !grepl("Ne", colnames(ga)), with = F]
ga1[, variable := "cumulative repayment"]
ga2 <- ga[, !grepl("Rep", colnames(ga)), with = F]
ga2[, variable := "weekly net saving"]
setnames(ga1, grepout("Re", colnames(ga1)), "amount")
setnames(ga2, grepout("Ne", colnames(ga2)), "amount")
ga <- rbindlist(list(ga1, ga2))
ga[, Arm := factor(Arm, labels = c(Arms[-4], "Cattle"))]
ga[, variable := factor(variable)]
ColourForPoints <- c("darkblue", "darkred")
g1 <- ggplot(ga[grepl("rep", variable), ], 
  aes(x = MonthsElapsed, y = amount, 
    colour = povertystatus, group = povertystatus)) +
  geom_point(aes(fill = povertystatus), size = .01, 
    position = position_dodge(width = .5), #colour = "transparent",
    alpha = .6) +
  geom_smooth(span = .5, size = .75,
    aes(colour = povertystatus, group = povertystatus)) +
  scale_colour_manual(values = ColourForPoints) +
  scale_fill_manual(values = c("blue", "red")) +
  theme(
    legend.position="none", 
    plot.margin = margin(t = 0, b = 0, l = 0, r = 0, "cm"),
    axis.text = element_text(size = 7),
    axis.title = element_text(size = 7),
    strip.text.x = element_text(color = "blue", size = 6, 
      margin = margin(0, .5, 0, .5, "cm")), 
    strip.text.y = element_text(color = "blue", size = 6, 
      margin = margin(.5, 0, .5, 0, "cm"))
  ) + 
  scale_y_continuous(limits = c(0, 20000)) +
  scale_x_continuous(limits = c(0, 48), breaks = seq(0, 48, 12))+
  xlab("Months since 1st loan disbursement") + 
  ylab("Amount (BDT)") +
  facet_grid(variable ~ Arm)
g2 <- ggplot(ga[grepl("sav", variable), ], 
  aes(x = MonthsElapsed, y = amount, 
    colour = povertystatus, group = povertystatus)) +
  geom_point(aes(fill = povertystatus), size = .01, 
    position = position_dodge(width = .5), #colour = "transparent",
    alpha = .6) +
  geom_smooth(span = .5, size = .75,
    aes(colour = povertystatus, group = povertystatus)) +
  scale_colour_manual(values = ColourForPoints) +
  scale_fill_manual(values = c("blue", "red")) +
  theme(
    legend.position="bottom", 
    legend.text = element_text(size = 7),
    legend.title = element_text(size = 9),
    legend.key = element_rect(fill = "white"),
    legend.key.size = unit(.25, "cm"),
    axis.text = element_text(size = 7),
    axis.title = element_text(size = 7),
    strip.text.x = element_text(color = "blue", size = 6, 
      margin = margin(0, .5, 0, .5, "cm")), 
    strip.text.y = element_text(color = "blue", size = 6, 
      margin = margin(.5, 0, .5, 0, "cm"))
  ) + 
  scale_y_continuous(limits = c(0, 800)) +
  scale_x_continuous(limits = c(0, 48), breaks = seq(0, 48, 12))+
  xlab("Months since 1st loan disbursement") + 
  ylab("Amount (BDT)") +
  facet_grid(variable ~ Arm)
library(gridExtra)
g <- grid.arrange(g1, g2, heights = c(2, 2.5), ncol=1)

Weekly net saving and cumulative repayment by poverty status

Weekly net saving and cumulative repayment by poverty status
ggsave(
  paste0(pathprogram, 
    "figure/ImpactEstimationOriginal1600Memo2/",
    "CumulativeWeeklyNetSavingAndRepayment.png"),
  g,
  width = 14, height = 10, units = "cm",
  dpi = 400
 )
library(grid)
cairo_pdf(
  paste0(pathprogram, 
    "figure/ImpactEstimationOriginal1600Memo2/",
    "CumulativeWeeklyNetSavingAndRepayment.pdf"),
  , width = 13/2.54, height = 10/2.54, pointsize = 10) # native unit: inch
grid.draw(g)
whatever <- dev.off()
Note: Each dot represents weekly observations. Only members who received loans are shown. Each panel shows weekly net saving (saving - withdrawal) or cumulative repayment against weeks after first disbursement. Lines are smoothed lines with a penalized cubic regression spline in ggplot2::geom_smooth function, originally from mgcv::gam with bs=cs’`.

Weekly net saving and cumulative repayment by poverty status

Weekly net saving and cumulative repayment by poverty status

Note: Each dot represents weekly observations. Only members who received loans are shown. Each panel shows ratios of cumulative repayment against cumulative due amount, sum of cumulative repayment and cumulative net saving (saving - withdrawal) against cumulative due amount, against weeks after first disbursement. Lines are smoothed lines with a penalized cubic regression spline in ggplot2::geom_smooth function, originally from mgcv::gam with bs=cs’`.

Click here to see the code of cumulative repaid rate plots.
library(ggplot2)
ga <- arA[!is.na(Date) & !is.na(DisDate1) & grepl("Yes", creditstatus) & 
  grepl("bo", BStatus) & o800 == 1L, 
  .(Arm, hhid, povertystatus, MonthsElapsed, 
  CumNetSaving, CumRepaid, CumRepaidRate, CumEffectiveRepaidRate)] 
####  ga1: amount
ga1 <- ga[, !grepl("Ne|Rate", colnames(ga)), with = F]
ga1[, variable := "repayment"]
####  ga2: rate
ga20 = copy(ga)
ga20 <- ga20[, grepout("Ne|Repaid$|variab", colnames(ga20)) := NULL]
ga20 <- ga20[!is.na(CumEffectiveRepaidRate) & 
  !is.na(CumEffectiveRepaidRate), ]
ga21 <- ga20[, .(Arm, hhid, povertystatus, MonthsElapsed, CumEffectiveRepaidRate)]
ga22 <- ga20[, .(Arm, hhid, povertystatus, MonthsElapsed, CumRepaidRate)]
setnames(ga21, "CumEffectiveRepaidRate", "value")
setnames(ga22, "CumRepaidRate", "value")
ga21[, variable := "Repay+net saving"]
ga22[, variable := "Repayment"]
ga2 <- rbindlist(list(ga21, ga22))
ga2[, variable := factor(variable, 
  levels = c("Repayment", "Repay+net saving"))]
setnames(ga1, grepout("Re", colnames(ga1)), "amount")
#setnames(ga2, grepout("Re", colnames(ga2)), "amount")
#ga <- rbindlist(list(ga1, ga2))
ColourForPoints <- c("darkblue", "darkred")
g <- ggplot(ga2, 
  aes(x = MonthsElapsed, y = value, 
    colour = povertystatus, group = povertystatus)) +
  geom_point(aes(fill = povertystatus), size = .01, 
    position = position_dodge(width = .5), #colour = "transparent",
    alpha = .6) +
  geom_smooth(span = .5, size = .5, #colour = "blue", 
    aes(colour = povertystatus, group = povertystatus)) +
  scale_colour_manual(values = ColourForPoints) +
  scale_fill_manual(values = c("blue", "red")) +
####   scale_shape_manual(values=c(21, 25)) +
  theme(
    legend.position="bottom", 
    legend.text = element_text(size = 7),
    legend.title = element_text(size = 9),
    legend.key = element_rect(fill = "white"),
    legend.key.size = unit(.5, "cm"),
    axis.text = element_text(size = 7),
    axis.title = element_text(size = 7),
    strip.text.x = element_text(color = "blue", size = 6, 
      margin = margin(0, .5, 0, .5, "cm")), 
    strip.text.y = element_text(color = "blue", size = 6, 
      margin = margin(.5, 0, .5, 0, "cm"))
  ) + 
  scale_y_continuous(limits = c(0, 2)) +
  scale_x_continuous(limits = c(0, 48), breaks = seq(0, 48, 12)) +
  xlab("Months since 1st loan disbursement") + 
  ylab("Cumulative repayment rates") +
  facet_grid(variable ~ Arm, scales = "free_y") +
  geom_hline(aes(yintercept = 1), colour = "lightgreen", data = ga2)
ggsave(
  paste0(pathprogram, 
    "figure/ImpactEstimationOriginal1600Memo2/",
    "CumulativeWeeklyRepaymentRateByPovertystatus.png"),
  g,
  width = 12, height = 6, units = "cm",
  dpi = 300
 )

Cumulative weekly net repayment rates by poverty status

Cumulative weekly net repayment rates by poverty status

The study followed the stepped wedge design within each group due to administrative and budgetary constraints. Our initial identification strategy was comaprison between arms and did not use the stepped wedge design to estimate impacts because of possible spillovers within a group and a relatively short period for outcomes to change before the control gets treated [We can estimate within-group, we may just have underestimated impacts]. A half of members in a group, approximately 800 in total, are assigned initially as the treated and then the rest was treated in the following months. So the number of the treated increased as time passes.

We restrict ourselves to this initial 800 members in estimating the impacts. We do so because of possible spill overs within groups. We compare between arms, not individuals in a group. One can see how impacts may differ if we compare between-group and within-group estimates. Such comparison is left as future exercises.

We will add a binary indicator function o800 to indicate the initial sample. In below, we first use the roster-administrative data to choose the households of o800, because it has the most complete record. Then, I look for these households in other files and create o800 variable in them.

Impact estimates

Assets

Click here to see the code.
library(ggplot2)
confi <- qread(paste0(pathsaveHere, "EstimatesCI.qs"))
confi1 <- confi[
  grepl("^NetAssets$", FileName) & 
  !grepl("None|Adi|Own", FileName) & 
  !grepl("Tr|Up", attributes) &
  grepl("^periN", hv) &
  grepl("Ta?$", regtype), ]
confi1[grepl("^Large$", attributes), attributes := "Large/Upfront"]
cols <- c("FileName", "regressand", "attributes", "regtype")
confi1[, (cols) := droplevels(.SD), .SDcols = cols]
confi1[, attributes := factor(attributes, levels = 
  c("Large/Upfront", "LargeGrace", "Cattle", "WithGrace", "InKind"))]
confi1[, num := factor(num-1)]
p <- ggplot(data = confi1
  , aes(x = factor(period), y = estimate, 
      colour = num, shape = num, group = num)) + 
  geom_pointrange(aes(
    ymin = lb, ymax = ub), 
    stat = "identity", fatten = 1.75, 
    position = position_dodge(width = .5))
p <- p + facet_grid( ~ attributes, scales = "free_y") + 
  scale_y_continuous(name = "impacts" #,limits = c(-.35, .15)
  ) +
  scale_x_discrete(name = "periods", breaks = 2:4) +
  theme(
   axis.text.x = element_text(size = 5, angle = 0, vjust = 1, hjust = 1), 
   axis.text.y = element_text(size = 6), 
   axis.title = element_text(size = 6), 
   strip.text.x = element_text(color = "blue", size = 9, 
     margin = margin(.1, 1.25, .1, 1.25, "cm")), 
   strip.text.y = element_text(color = "blue", size = 9, 
     margin = margin(1.5, .1, 1.5, .1, "cm")),
   panel.spacing.x = unit(c(.1, .1, .3, .1), units = "cm"),
   panel.spacing.y = unit(.1, units = "cm"),
   legend.position="bottom") + 
  xlab("periods") + 
  labs(color  = "regression specifications", shape = "regression specifications") +
  guides(colour = guide_legend(title = "regression specifications", nrow = 1)) +
  geom_hline(aes(yintercept = 0), data = confi1, colour = "lightgreen")
p <- p + ggh4x::facet_nested( ~ AtType+attributes, scales = "free_y")
ggsave(
  paste0(pathprogram, 
  "figure/EstimationMemo/NetAssetsEffects.jpg"),
  p,
  width = 13*2, height = 6*2, units = "cm",
  dpi = 600
 )
pdf(
  paste0(pathprogram, 
  "figure/EstimationMemo/NetAssetsEffects.pdf")
  , width = 2*12/2.54, height = 2*5/2.54)
print(p)
whatever <- dev.off()
library(ggplot2)
confi <- qread(paste0(pathsaveHere, "EstimatesCI.qs"))
confi1 <- confi[
  grepl("Annual|^NetB|NetNL|ws$", FileName) & 
  !grepl("None|Adi|Own", FileName) & 
  !grepl("Tr|Up", attributes) &
  grepl("^periN", hv) &
  grepl("T$", regtype) & num > 1, ]
confi1[grepl("^Large$", attributes), attributes := "Large"]
cols <- c("FileName", "regressand", "attributes", "regtype")
confi1[, (cols) := droplevels(.SD), .SDcols = cols]
confi1[, regressand := factor(regressand, levels = 
  c("net assets, AP", "net non-livestock assets", "net broad assets", "cattle"))]
confi1[, regressand := factor(regressand, labels = 
  c("Net assets,\nannual price (BDT)", "Net non-livestock\n assets (BDT)", 
  "Net broad assets\n (BDT)", "Cattle (counts)"))]
table(confi1[,.(attributes, regressand)])
            regressand
attributes   Net assets,\nannual price (BDT) Net non-livestock\n assets (BDT)
  Large                                   15                               15
  LargeGrace                              15                               15
  Cattle                                  15                               15
            regressand
attributes   Net broad assets\n (BDT) Cattle (counts)
  Large                            15               9
  LargeGrace                       15               9
  Cattle                           15               9
confi1[, num := factor(num-1)]
p <- ggplot(data = confi1
  , aes(x = factor(period), y = estimate, 
      colour = num, shape = num, group = num)) + 
  geom_pointrange(aes(
    ymin = lb, ymax = ub), 
    stat = "identity", fatten = 1.75, 
    position = position_dodge(width = .5))
p <- p + facet_grid(regressand ~ attributes, scales = "free_y") + 
  scale_y_continuous(name = "impacts" #,limits = c(-.35, .15)
  ) +
  scale_x_discrete(name = "periods", breaks = 2:4) +
  theme(
   axis.text.x = element_text(size = 7, angle = 0, vjust = 1, hjust = 1), 
   axis.text.y = element_text(size = 8), 
   axis.title = element_text(size = 8), 
   strip.text.x = element_text(color = "blue", size = 9, 
     margin = margin(.1, 1.25, .1, 1.25, "cm")), 
   strip.text.y = element_text(color = "blue", size = 9, 
     margin = margin(1.5, .1, 1.5, .1, "cm")),
   #panel.spacing.x = unit(c(.1, .1, .3, .1), units = "cm"),
   #panel.spacing.y = unit(.1, units = "cm"),
   legend.position="bottom") + 
  xlab("periods") + 
  labs(color  = "regression specifications", shape = "regression specifications") +
  guides(colour = guide_legend(title = "regression specifications", nrow = 1)) +
  geom_hline(aes(yintercept = 0), data = confi1, colour = "lightgreen")
ggsave(
  paste0(pathprogram, 
  "figure/EstimationMemo/NetAssetsNetBroadAssetsNLAssetsCattleEffects.jpg"),
  p,
  width = 13*1.5, height = 12*1.5, units = "cm",
  dpi = 300
 )
pdf(
  paste0(pathprogram, 
  "figure/EstimationMemo/NetAssetsNetBroadAssetsNLAssetsCattleEffects.pdf")
  , width = 2*12/2.54, height = 2*8/2.54)
print(p)
whatever <- dev.off()

Net asset impacts are estimated with ANCOVA. Large/Upfront , LargeGrace, and Cattle give impacts relative to Traditional arm. `WithGrace gives the grace period impacts relative to Upfront. InKind gives the impacts of managerial supports relative to the combination of Upfront and WithGrace. s```

Robustness checks: Impacts on various asset measures. Time-varying impacts on net assets evaluated with annualised price, net broad assets, non-livestock assets (BDT), and cattle holding (counts). Net asset value = livestock asset value + non-livestock asset value - debt. Net broad assets use all asset items, net assets in our main results only use asset items appearing in all rounds. Net assets, annual price uses annual median price for livestock evaluation while Net assets uses median price of all rounds. Columns of Large, Large grace, and Cattle show impacts relative to the Traditional arm. 4th and 5th regression specifications use baseline cattle count and baseline cattle ownership dummy variable as covariates, hence they are omitted from impacts on Cattle (counts). s```

Robust to:

  • Choice of asset definition (net broad assets vs. net assets).
  • Choice of price index (overall median vs. annual median).
  • Choice of asset type (total vs. non-livestock vs. cattle).

Schooling

Click here to see the code.
library(ggplot2)
confis <- qread(paste0(pathsaveHere, "EstimatesCISchooling.qs"))
confi2 <- unique(confis)
confi2 <- confi2[!grepl("^Up", attributes), ]
confi2 <- confi2[grepl("^Large$", attributes), attributes := "Large/Upfront"]
confi2 <- confi2[grepl("T$", regtype), ]
cols <- c("FileName", "school", "attributes")
confi2[, (cols) := droplevels(.SD), .SDcols = cols]
confi2[, attributes := factor(attributes, levels = 
  c("Traditional", "Large/Upfront", "LargeGrace", "Cattle"))]
confi2[, attributes := factor(attributes, labels = 
  c("Traditional", "Large", "LargeGrace", "Cattle"))]
#### Trad: Level in each period at school i
confi2t <- confi2[(grepl("^Tra", attributes) & grepl("lev.* trad.*ea", ImpactType)) & num >= 5, ]
#### Nontrad: nontrad - trad, in each period, at school i
confi2n <- confi2[grepl("change", ImpactType) & num >= 5, ][order(gender, period), ]
confi3 <- rbind(confi2t, confi2n)
confi3[, num := factor(num-4)]
faccol <- c("attributes", "gender", "ImpactType", "hv", "regtype", "num")
confi3[, (faccol) := lapply(.SD, droplevels), .SDcol = faccol]
table(confi3[,.(ImpactType, attributes)])
                                                                       attributes
ImpactType                                                              Traditional Large
  level of trad in each period at school                                         18     0
  level of female trad in each period at school                                  18     0
  nontrad change - trad change, in each period, at school                         0    18
  female nontrad change - female trad change, in each period, at school           0    18
                                                                       attributes
ImpactType                                                              LargeGrace Cattle
  level of trad in each period at school                                         0      0
  level of female trad in each period at school                                  0      0
  nontrad change - trad change, in each period, at school                       18     18
  female nontrad change - female trad change, in each period, at school         18     18
confi3[, numgen := paste0(gender, ", spec", num)]
confi3[, effects := "Level estimates"]
confi3[!grepl("Trad", attributes), effects := "Marginal impacts relative to Traditional"]
confi3[, numgen := paste0(gender, ", spec", num)]
confi3[, effects := "Level estimates"]
confi3[!grepl("Trad", attributes), effects := "Marginal impacts relative to Traditional"]
p <- ggplot(data = confi3
  , aes(x = factor(period), y = estimate, 
      colour = numgen, shape = numgen, group = numgen)) + 
  geom_pointrange(aes(
    ymin = lb, ymax = ub), 
    stat = "identity", fatten = 1.75, 
    position = position_dodge(width = .25))
p <- p + facet_grid(school ~ attributes, scales = "free_y") + 
  scale_y_continuous(name = "impacts" #,limits = c(-.35, .15)
  ) +
  scale_x_discrete(name = "periods", breaks = 2:4) +
  theme(
   axis.text.x = element_text(size = 7, angle = 0, vjust = 1, hjust = 1), 
   axis.text.y = element_text(size = 7), 
   axis.title = element_text(size = 7), 
   strip.text.x = element_text(color = "blue", size = 9, 
     margin = margin(.1, 1.25, .1, 1.25, "cm")), 
   strip.text.y = element_text(color = "blue", size = 9, 
     margin = margin(1.5, .1, 1.5, .1, "cm")),
   panel.spacing.x = unit(c(.3, .1, .1), units = "cm"),
   panel.spacing.y = unit(.1, units = "cm"),
   legend.position="bottom",
   legend.key.size = unit(0.1, "cm"),
   legend.text = element_text(size = 7)) + 
  xlab("periods") + 
  labs(color  = "gender, regression specifications", shape = "gender, regression specifications") +
  guides(colour = guide_legend(title = "gender, regression specifications", nrow = 1)) +
  geom_hline(aes(yintercept = 0), data = confi3, colour = "lightgreen")
p <- p + ggh4x::facet_nested(school ~ effects + attributes, scales = "free_y")
ggsave(
  paste0(pathprogram, 
  "figure/EstimationMemo/SchoolingEffectsConcurrentWithTradByArm.jpg"),
  p,
  width = 14*2, height = 12*2, units = "cm",
  dpi = 450
 )
pdf(
  paste0(pathprogram, 
  "figure/EstimationMemo/SchoolingEffectsConcurrentWithTradByArm.pdf"),
  , width = 12*2/2.54, height = 12*2/2.54)
print(p)
whatever <- dev.off()
library(ggplot2)
confis <- qread(paste0(pathsaveHere, "EstimatesCISchooling.qs"))
confi2 <- unique(confis)
confi2 <- confi2[grepl("^Large$", attributes), attributes := "Large/Upfront"]
confi2 <- confi2[grepl("Ta$", regtype), ]
cols <- c("FileName", "school", "attributes")
confi2[, (cols) := droplevels(.SD), .SDcols = cols]
confi2[, attributes := factor(attributes, levels = 
  c("Traditional", "Upfront", "WithGrace", "InKind"))]
#### Trad: Level in each period at school i
confi2t <- confi2[(grepl("^Tra", attributes) & grepl("lev.* trad.*ea", ImpactType)) & num >= 5, ]
#### Nontrad: nontrad - trad, in each period, at school i
confi2n <- confi2[grepl("change", ImpactType) & num >= 5, ][order(gender, period), ]
confi3 <- rbind(confi2t, confi2n)
confi3[, num := factor(num-4)]
faccol <- c("attributes", "gender", "ImpactType", "hv", "regtype", "num")
confi3[, (faccol) := lapply(.SD, droplevels), .SDcol = faccol]
table(confi3[,.(ImpactType, attributes)])
                                                                       attributes
ImpactType                                                              Traditional Upfront
  level of trad in each period at school                                         18       0
  level of female trad in each period at school                                  18       0
  nontrad change - trad change, in each period, at school                         0      18
  female nontrad change - female trad change, in each period, at school           0      18
                                                                       attributes
ImpactType                                                              WithGrace InKind
  level of trad in each period at school                                        0      0
  level of female trad in each period at school                                 0      0
  nontrad change - trad change, in each period, at school                      18     18
  female nontrad change - female trad change, in each period, at school        18     18
confi3[, numgen := paste0(gender, ", spec", num)]
confi3[, effects := "Level estimates"]
confi3[!grepl("Trad", attributes), effects := "Marginal impacts relative to \nTraditional, Upfront, Upfront+WithGrace"]
confi3[, attributes := factor(attributes, label = c("Traditional", 
  "Upfront\nrelative to Traditional", "WithGrace\nrelative to Upfront", 
  "InKind\nrelative to Upfront+WithGrace"))]
p <- ggplot(data = confi3
  , aes(x = factor(period), y = estimate, 
      colour = numgen, shape = numgen, group = numgen)) + 
  geom_pointrange(aes(
    ymin = lb, ymax = ub), 
    stat = "identity", fatten = 1.75, 
    position = position_dodge(width = .25))
p <- p + facet_grid(school * gender ~ attributes, scales = "free_y") + 
  scale_y_continuous(name = "impacts" #,limits = c(-.35, .15)
  ) +
  scale_x_discrete(name = "periods", breaks = 2:4) +
  theme(
   axis.text.x = element_text(size = 7, angle = 0, vjust = 1, hjust = 1), 
   axis.text.y = element_text(size = 7), 
   axis.title = element_text(size = 7), 
   strip.text.x = element_text(color = "blue", size = 8, 
     margin = margin(.1, 1.25, .1, 1.25, "cm")), 
   strip.text.y = element_text(color = "blue", size = 9, 
     margin = margin(1.5, .1, 1.5, .1, "cm")),
   panel.spacing.x = unit(c(.3, .1, .1), units = "cm"),
   panel.spacing.y = unit(.1, units = "cm"),
   legend.position="bottom",
   legend.key.size = unit(0.1, "cm"),
   legend.text = element_text(size = 7)) + 
  xlab("periods") + 
  labs(color  = "regression specifications", shape = "regression specifications") +
  guides(colour = guide_legend(title = "regression specifications", nrow = 1)) +
  geom_hline(aes(yintercept = 0), data = confi3, colour = "lightgreen")
p <- p + ggh4x::facet_nested(school ~ effects + attributes, scales = "free_y")
ggsave(
  paste0(pathprogram, 
  "figure/EstimationMemo/SchoolingEffectsConcurrentWithTradByFunAttribute.jpg"),
  p,
  width = 14*2, height = 12*2, units = "cm",
  dpi = 450
 )
pdf(
  paste0(pathprogram, 
  "figure/EstimationMemo/SchoolingEffectsConcurrentWithTradByFunAttribute.pdf"),
  , width = 12*2/2.54, height = 10*2/2.54)
print(p)
whatever <- dev.off()

Schooling impacts by arm and by period. Impacts are relative to concurrent Traditional arm. Traditional shows raw enrollment rates of Traditional arm. Large , LargeGrace, and Cattle give impacts relative to concurrent Traditional arm.

Schooling impacts by functional attribute and by period. Impacts are relative to respective concurrent functional attrnibutes. Traditional shows raw enrollment rates of Traditional arm. Upfront gives concurrent upfront liquidity impacts relative to Traditional. WithGrace gives concurrent grace period impacts relative to Upfront. InKind gives concurrent impacts of managerial supports relative to the sum of Upfront and WithGrace.

  • Primary school aged boys’ schooling is negatively affected for Upfront functional attribute, especially towards the final round.

Consumption and labour incomes

Click here to see the code.
library(ggplot2)
confi <- qread(paste0(pathsaveHere, "EstimatesCI.qs"))
confi2 <- confi[
  (grepl("Lab", FileName) |(grepl("OLS", FileName) & num <= 3)) &
  #grepl("^Ta?$", regtype) & For Arm, Fun Attribute panels
  grepl("^T$", regtype) & 
  # traditional gross level, nontrad cumulative relative to trad gross
  ((grepl("Tra", attributes) & grepl("lev.* trad.*d$", ImpactType)) |
    (!grepl("Tra", attributes) & grepl("sum", ImpactType))), ]
confi2[grepl("^Large$", attributes), attributes := "Large/Upfront"]
confi2[grepl("Fun", AtType), 
  AtType := "Functional attributes\n (relative to Upfront, Upfront+WithGrace)"]
confi2 <- confi2[!grepl("^Up", attributes), ]
confi2[, attributes := factor(attributes, levels = 
  c("Traditional", "Large/Upfront", "LargeGrace", "Cattle",
    "WithGrace", "InKind"))]
confi3 <- confi2[!grepl("Tra", attributes), ]
cols <- c("FileName", "regressand", "attributes", "hv", "ImpactType", "AtType")
confi3[, (cols) := droplevels(.SD), .SDcols = cols]
confi3[grepl("lab", regressand), num := num-1]
confi3[, num := factor(num)]
#confi2[grepl("Lab", FileName), estimate := estimate*100]
#confi2[grepl("Lab", FileName), ub := ub*100]
#confi2[grepl("Lab", FileName), lb := lb*100]
p <- ggplot(data = confi3
  , aes(x = factor(period), y = estimate, 
      colour = num, shape = num, group = num)) + 
  geom_pointrange(aes(
    ymin = lb, ymax = ub), 
    stat = "identity", fatten = 1.75, 
    position = position_dodge(width = .5))
p <- p + facet_grid(regressand ~ attributes, scales = "free_y",
   labeller = label_wrap_gen(multi_line = TRUE)) + 
  scale_y_continuous(name = "impacts" #,limits = c(-.35, .15)
  ) +
  scale_x_discrete(name = "periods", breaks = 2:4) +
  theme(
   axis.text.x = element_text(size = 5, angle = 0, vjust = 1, hjust = 1), 
   axis.text.y = element_text(size = 6), 
   axis.title = element_text(size = 6), 
   strip.text.x = element_text(color = "blue", size = 9, 
     margin = margin(.1, 1.25, .1, 1.25, "cm")), 
   strip.text.y = element_text(color = "blue", size = 9, 
     margin = margin(1.5, .1, 1.5, .1, "cm")),
   #panel.spacing.x = unit(c(.1, .1, .3, .1), units = "cm"), For Arm, Fun Attribute panels
   panel.spacing.x = unit(c(.1, .1), units = "cm"),
   panel.spacing.y = unit(.1, units = "cm"),
   legend.position="bottom") + 
  xlab("periods") + 
  labs(color  = "regression specifications", shape = "regression specifications") +
  guides(colour = guide_legend(title = "regression specifications", nrow = 1)) +
  geom_hline(aes(yintercept = 0), data = confi3, colour = "lightgreen")
#p <- p + ggh4x::facet_nested(regressand ~ AtType+attributes, scales = "free_y")
ggsave(
  paste0(pathprogram, 
  "figure/EstimationMemo/IncomeConsumptionEffects.jpg"),
  p,
  width = 13*2, height = 8*2, units = "cm",
  dpi = 300*4
 )
pdf(
  paste0(pathprogram, 
  "figure/EstimationMemo/IncomeConsumptionEffects.pdf"),
  , width = 13*2/2.54, height = 8*2/2.54)
print(p)
whatever <- dev.off()

Consumption and labour income impacts. Large/Upfront , LargeGrace, and Cattle give impacts relative to Traditional arm. Consumption impacts are estimated with OLS, labour income impacts are estimated with ANCOVA. There are only two regression specifications for consumption, because we do not expect net asset at baseline or cattle holding at baseline to affect consumption changes. Results using these covariates give qualitatively the same results.

Net assets by experience

Click here to see the code.
library(ggplot2)
confi <- qread(paste0(pathsaveHere, "EstimatesCI.qs"))
cie1 <- confi[
  grepl("^NetA.*ts", FileName) & grepl("^non.*-.*\\,", ImpactType) & 
  grepl("Adi|None|Own", regressand) & 
  grepl("^T$", regtype), ]
cols <- c("FileName", "regressand", "attributes", "ImpactType")
cie1[, (cols) := droplevels(.SD), .SDcols = cols]
cie1[, SubGroup := factor(gsub(".*ts\\, ", "", regressand))]
cie1[, SubGroup := factor(SubGroup, levels = c("Own", "Adi", "None"))]
cie1[, SubGroup := factor(SubGroup, labels = c("Owner", "Adi", "None"))]
cie1[, num := factor(num-1)]
cie1[, num := gsub("^", "Spec ", num)]
p <- ggplot(data = cie1
  , aes(x = factor(period), y = estimate, 
      colour = SubGroup, shape = SubGroup, group = SubGroup), size = .1) + 
  geom_pointrange(aes(
    ymin = lb, ymax = ub), 
    stat = "identity", fatten = 1.75, 
    position = position_dodge(width = .5))
p <- p + facet_grid(num ~ attributes) + 
  scale_y_continuous(name = "impacts" #,limits = c(-.35, .15)
  ) +
  scale_x_discrete(name = "periods", breaks = 2:4) +
  theme(
   axis.text.x = element_text(size = 7, angle = 0, vjust = 1, hjust = 1), 
   axis.text.y = element_text(size = 8), 
   axis.title = element_text(size = 8), 
   strip.text.x = element_text(color = "blue", size = 9, 
     margin = margin(.1, 1.25, .1, 1.25, "cm")), 
   strip.text.y = element_text(color = "blue", size = 9, 
     margin = margin(1.5, .1, 1.5, .1, "cm")),
   #panel.spacing.x = unit(c(.1, .1, .3, .1), units = "cm"),
   #panel.spacing.y = unit(.1, units = "cm"),
   legend.text = element_text(size = 7),
   legend.title = element_text(size = 7),
   legend.key = element_rect(fill = "white"),
   legend.key.size = unit(.25, "cm"),
   legend.position="bottom") + 
  xlab("periods") + 
  labs(color  = "Group by experience", shape = "Group by experience") +
  guides(
    colour = guide_legend(title = "Group by experience", nrow = 1),
    shape = guide_legend(override.aes = list(size = .125))) +
  geom_hline(aes(yintercept = 0), data = cie1, colour = "lightgreen")
ggsave(
  paste0(pathprogram, 
  "figure/EstimationMemo/NetAssetsByExperienceEffects.jpg")
  , p,
  width = 12*2, height = 6*2, units = "cm",
  dpi = 300*4
 )
pdf(
  paste0(pathprogram, 
  "figure/EstimationMemo/NetAssetsByExperienceEffects.pdf")
  , width = 2*12/2.54, height = 2*6/2.54)
print(p)
whatever <- dev.off()

Net assets, experienced vs. inexperienced. Columns of Large, Large grace, and Cattle show impacts relative to the Traditional arm.

Cattle holding by experience

Click here to see the code.
library(ggplot2)
confi <- qread(paste0(pathsaveHere, "EstimatesCI.qs"))
confie1 <- confi[
  grepl("^Num", FileName) & 
  !grepl("Exp", FileName) & 
  grepl("^periN", hv) & 
  grepl("^T$", regtype) & 
  !grepl("Trad", attributes), ]
cols <- c("FileName", "regressand", "attributes")
confie1[, (cols) := droplevels(.SD), .SDcols = cols]
confie1[, SubGroup := factor(gsub(".*tle\\, ", "", regressand))]
confie1[, SubGroup := factor(SubGroup, levels = c("cattle", "Own", "Adi", "None"))]
confie1[, SubGroup := factor(SubGroup, labels = c("All members", "Owner", "Adi", "None"))]
addmargins(table(confie1[, .(SubGroup, num)]))
             num
SubGroup        1   2   3   4 Sum
  All members   9   9   9   9  36
  Owner         9   9   9   0  27
  Adi           9   9   9   0  27
  None          9   9   9   0  27
  Sum          36  36  36   9 117
#### Comparable: 
####  NumCows (All) 1 = 1 in all others (not included in confi)
####  NumCows (All) 2 = 2 in Own, 
####  NumCows (All) 3 = 3 in Own, 3 in Adi, None (OLS, so not strictly comparable)
####  NumCows (All) 4: does not exist in Own, Adi, None 
confie2 <- confie1[grepl("1", num), ]
p <- ggplot(data = confie2
  , aes(x = factor(period), y = estimate, 
      colour = SubGroup, shape = SubGroup, group = SubGroup), size = .1) + 
  geom_pointrange(aes(
    ymin = lb, ymax = ub), 
    stat = "identity", fatten = 1.75, 
    position = position_dodge(width = .5))
p <- p + facet_grid( ~ attributes) + 
  scale_y_continuous(name = "impacts" #,limits = c(-.35, .15)
  ) +
  scale_x_discrete(name = "periods", breaks = 2:4) +
  theme(
   axis.text.x = element_text(size = 7, angle = 0, vjust = 1, hjust = 1), 
   axis.text.y = element_text(size = 8), 
   axis.title = element_text(size = 8), 
   strip.text.x = element_text(color = "blue", size = 9, 
     margin = margin(.1, 1.25, .1, 1.25, "cm")), 
   strip.text.y = element_text(color = "blue", size = 9, 
     margin = margin(1.5, .1, 1.5, .1, "cm")),
   #panel.spacing.x = unit(c(.1, .1, .3, .1), units = "cm"),
   #panel.spacing.y = unit(.1, units = "cm"),
   legend.text = element_text(size = 7),
   legend.title = element_text(size = 7),
   legend.key = element_rect(fill = "white"),
   legend.key.size = unit(.25, "cm"),
   legend.position="bottom") + 
  xlab("periods") + 
  labs(color  = "Group by experience", shape = "Group by experience") +
  guides(
    colour = guide_legend(title = "Group by experience", nrow = 1),
    shape = guide_legend(override.aes = list(size = .125))) +
  geom_hline(aes(yintercept = 0), data = confie2, colour = "lightgreen")
ggsave(
  paste0(pathprogram, 
  "figure/EstimationMemo/NumCowsByExperienceEffects.jpg")
  , p,
  width = 12*2, height = 4*2, units = "cm",
  dpi = 300
 )
pdf(
  paste0(pathprogram, 
  "figure/EstimationMemo/NumCowsByExperienceEffects.pdf")
  , width = 2*12/2.54, height = 2*4/2.54)
print(p)
whatever <- dev.off()

Cattle holding, experienced vs. inexperienced. Columns of Large, Large grace, and Cattle show impacts relative to the Traditional arm.

Results by poverty class

Click here to see the code.
library(ggplot2)
confi <- qread(paste0(pathsaveHere, "EstimatesCI.qs"))
confi2 <- confi[
  (grepl("Lab", FileName) |(grepl("OLS", FileName) & num <= 3)) &
  grepl("^TP$", regtype) & grepl("sum.*poor non", ImpactType), ]
confi2[grepl("on", regressand), regressand := "Per capita consumption\n(BDT)"]
confi2[!grepl("on", regressand), regressand := "Labour income\n(BDT)"]
cols <- c("FileName", "regressand", "attributes", "hv", "ImpactType", "AtType")
confi2[, (cols) := droplevels(.SD), .SDcols = cols]
confi2[grepl("lab", regressand), num := num-1]
confi2[, num := factor(num)]
p <- ggplot(data = confi2
  , aes(x = factor(period), y = estimate, 
      colour = num, shape = num, group = num)) + 
  geom_pointrange(aes(
    ymin = lb, ymax = ub), 
    stat = "identity", fatten = 1.75, 
    position = position_dodge(width = .5))
p <- p + facet_grid(regressand ~ attributes, scales = "free_y",
   labeller = label_wrap_gen(multi_line = TRUE)) + 
  scale_y_continuous(name = "impacts" #,limits = c(-.35, .15)
  ) +
  scale_x_discrete(name = "periods", breaks = 2:4) +
  theme(
   axis.text.x = element_text(size = 5, angle = 0, vjust = 1, hjust = 1), 
   axis.text.y = element_text(size = 6), 
   axis.title = element_text(size = 6), 
   strip.text.x = element_text(color = "blue", size = 9, 
     margin = margin(.1, 1.25, .1, 1.25, "cm")), 
   strip.text.y = element_text(color = "blue", size = 9, 
     margin = margin(1.5, .1, 1.5, .1, "cm")),
   #panel.spacing.x = unit(c(.1, .1, .3, .1), units = "cm"), For Arm, Fun Attribute panels
   panel.spacing.x = unit(c(.1, .1), units = "cm"),
   panel.spacing.y = unit(.1, units = "cm"),
   legend.position="bottom") + 
  xlab("periods") + 
  labs(color  = "regression specifications", shape = "regression specifications") +
  guides(colour = guide_legend(title = "regression specifications", nrow = 1)) +
  geom_hline(aes(yintercept = 0), data = confi2, colour = "lightgreen")
#p <- p + ggh4x::facet_nested(regressand ~ AtType+attributes, scales = "free_y")
ggsave(
  paste0(pathprogram, 
  "figure/EstimationMemo/IncomeConsumptionPovertyEffects.jpg"),
  p,
  width = 13*2, height = 6*2, units = "cm",
  dpi = 300
 )
pdf(
  paste0(pathprogram, 
  "figure/EstimationMemo/IncomeConsumptionPovertyEffects.pdf"),
  , width = 13*2/2.54, height = 6*2/2.54)
print(p)
whatever <- dev.off()

Impacts on consumption and incomes of the ultra poor relative to the moderately poor. Columns of Large, Large grace, and Cattle show impacts relative to the moderately poor of the same arm.

  • Consumption of the ultra poor was smaller in Large and Cattle arms from period 3 onwards.
  • This is consistent with the repayment burden to be excessive for the ultra poor, implicating a longer maturity or saving periods.